From 6bcbf113bc7ce35d0fdd47acf780c753f2fed245 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Sun, 28 Jun 2020 14:18:16 +0200 Subject: [PATCH 01/51] add basic user delete endpoint - deletes user - deletes sessions of user --- app/controllers/api/users.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index d1744bf48a..a73c656881 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -188,6 +188,38 @@ $utopia->get('/v1/users/:userId') } ); +$utopia->delete('/v1/users/:userId') + ->desc('Delete User') + ->groups(['api', 'users']) + ->label('scope', 'users.write') + ->label('sdk.platform', [APP_PLATFORM_SERVER]) + ->label('sdk.namespace', 'users') + ->label('sdk.method', 'deleteUser') + ->label('sdk.description', '/docs/references/users/delete-user.md') + ->label('abuse-limit', 100) + ->param('userId', '', function () {return new UID();}, 'User unique ID.') + ->action( + function ($userId) use ($response, $request, $projectDB) { + $user = $projectDB->getDocument($userId); + + if (empty($user->getId()) || Database::SYSTEM_COLLECTION_USERS != $user->getCollection()) { + throw new Exception('User not found', 404); + } + if (!$projectDB->deleteDocument($userId)) { + throw new Exception('Failed to remove file from DB', 500); + } + $tokens = $user->getAttribute('tokens', []); + + foreach ($tokens as $token) { + if (!$projectDB->deleteDocument($token->getId())) { + throw new Exception('Failed to remove token from DB', 500); + } + } + + $response->noContent(); + } + ); + $utopia->get('/v1/users/:userId/prefs') ->desc('Get User Preferences') ->groups(['api', 'users']) From 4c6a300a220af5ecf09ef3680fefb06800800192 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 2 Jul 2020 23:48:37 +0200 Subject: [PATCH 02/51] delete leftovers & reserve id - delete team memberships - create a reserved id --- app/config/collections.php | 7 +++++++ app/controllers/api/users.php | 28 ++++++++++++++++++++++++++++ src/Appwrite/Database/Database.php | 1 + 3 files changed, 36 insertions(+) diff --git a/app/config/collections.php b/app/config/collections.php index 3141419c1b..f40488950e 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -1187,6 +1187,13 @@ $collections = [ ], ], ], + Database::SYSTEM_COLLECTION_RESERVED => [ + '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS, + '$id' => Database::SYSTEM_COLLECTION_RESERVED, + '$permissions' => ['read' => ['*']], + 'name' => 'Reserved', + 'structure' => true, + ], ]; /* diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index a73c656881..01c4d01622 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -208,6 +208,19 @@ $utopia->delete('/v1/users/:userId') if (!$projectDB->deleteDocument($userId)) { throw new Exception('Failed to remove file from DB', 500); } + + $reservedId = $projectDB->createDocument([ + '$collection' => Database::SYSTEM_COLLECTION_RESERVED, + '$id' => $userId, + '$permissions' => [ + 'read' => ['*'], + ], + ]); + + if (false === $reservedId) { + throw new Exception('Failed saving reserved id to DB', 500); + } + $tokens = $user->getAttribute('tokens', []); foreach ($tokens as $token) { @@ -216,6 +229,21 @@ $utopia->delete('/v1/users/:userId') } } + $memberships = $projectDB->getCollection([ + 'limit' => 2000, + 'offset' => 0, + 'filters' => [ + '$collection='.Database::SYSTEM_COLLECTION_MEMBERSHIPS, + 'userId='.$userId, + ], + ]); + + foreach ($memberships as $membership) { + if (!$projectDB->deleteDocument($membership->getId())) { + throw new Exception('Failed to remove team membership from DB', 500); + } + } + $response->noContent(); } ); diff --git a/src/Appwrite/Database/Database.php b/src/Appwrite/Database/Database.php index e75eb01b51..bd61eb3ffd 100644 --- a/src/Appwrite/Database/Database.php +++ b/src/Appwrite/Database/Database.php @@ -23,6 +23,7 @@ class Database const SYSTEM_COLLECTION_USAGES = 'usages'; //TODO add structure const SYSTEM_COLLECTION_DOMAINS = 'domains'; const SYSTEM_COLLECTION_CERTIFICATES = 'certificates'; + const SYSTEM_COLLECTION_RESERVED = 'reserved'; // Auth, Account and Users (private to user) const SYSTEM_COLLECTION_USERS = 'users'; From 7484bdc34751231d8fa5336ab62b7da24bbb5d91 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 3 Jul 2020 00:42:21 +0200 Subject: [PATCH 03/51] outsource user leftovers to delete worker --- app/controllers/api/users.php | 27 +++------------------------ app/workers/deletes.php | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 01c4d01622..2592076d3f 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -199,14 +199,14 @@ $utopia->delete('/v1/users/:userId') ->label('abuse-limit', 100) ->param('userId', '', function () {return new UID();}, 'User unique ID.') ->action( - function ($userId) use ($response, $request, $projectDB) { + function ($userId) use ($response, $deletes, $projectDB) { $user = $projectDB->getDocument($userId); if (empty($user->getId()) || Database::SYSTEM_COLLECTION_USERS != $user->getCollection()) { throw new Exception('User not found', 404); } if (!$projectDB->deleteDocument($userId)) { - throw new Exception('Failed to remove file from DB', 500); + throw new Exception('Failed to remove user from DB', 500); } $reservedId = $projectDB->createDocument([ @@ -221,28 +221,7 @@ $utopia->delete('/v1/users/:userId') throw new Exception('Failed saving reserved id to DB', 500); } - $tokens = $user->getAttribute('tokens', []); - - foreach ($tokens as $token) { - if (!$projectDB->deleteDocument($token->getId())) { - throw new Exception('Failed to remove token from DB', 500); - } - } - - $memberships = $projectDB->getCollection([ - 'limit' => 2000, - 'offset' => 0, - 'filters' => [ - '$collection='.Database::SYSTEM_COLLECTION_MEMBERSHIPS, - 'userId='.$userId, - ], - ]); - - foreach ($memberships as $membership) { - if (!$projectDB->deleteDocument($membership->getId())) { - throw new Exception('Failed to remove team membership from DB', 500); - } - } + $deletes->setParam('document', $user); $response->noContent(); } diff --git a/app/workers/deletes.php b/app/workers/deletes.php index aa0cbe6c2d..8d12bd64d0 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -29,6 +29,9 @@ class DeletesV1 case Database::SYSTEM_COLLECTION_PROJECTS: $this->deleteProject($document); break; + case Database::SYSTEM_COLLECTION_USERS: + $this->deleteUser($document); + break; default: break; @@ -52,4 +55,32 @@ class DeletesV1 $uploads->delete($uploads->getRoot(), true); $cache->delete($cache->getRoot(), true); } + + protected function deleteUser(Document $user) + { + global $projectDB; + + $tokens = $user->getAttribute('tokens', []); + + foreach ($tokens as $token) { + if (!$projectDB->deleteDocument($token->getId())) { + throw new Exception('Failed to remove token from DB', 500); + } + } + + $memberships = $projectDB->getCollection([ + 'limit' => 2000, // TODO add members limit + 'offset' => 0, + 'filters' => [ + '$collection='.Database::SYSTEM_COLLECTION_MEMBERSHIPS, + 'userId='.$user->getId(), + ], + ]); + + foreach ($memberships as $membership) { + if (!$projectDB->deleteDocument($membership->getId())) { + throw new Exception('Failed to remove team membership from DB', 500); + } + } + } } From 7b3adbe2b09cfba1fe4480467745566b47eed210 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 1 Aug 2020 06:48:36 +0300 Subject: [PATCH 04/51] Added Deno SDK --- README.md | 1 + app/config/platforms.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bc78047f0f..4e410a5437 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ Below is a list of currently supported platforms and languages. If you wish to h #### 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) diff --git a/app/config/platforms.php b/app/config/platforms.php index b424b06e5e..e3bda605e5 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -167,7 +167,7 @@ return [ 'name' => 'Deno', 'version' => '0.0.2', 'url' => 'https://github.com/appwrite/sdk-for-deno', - 'enabled' => false, + 'enabled' => true, 'beta' => true, 'dev' => false, 'family' => APP_PLATFORM_SERVER, From b3bc2ee3c42e589c2eb6d63e11f77741f6f2fa58 Mon Sep 17 00:00:00 2001 From: Herdi Tr <35950229+Hrdtr@users.noreply.github.com> Date: Tue, 25 Aug 2020 23:47:17 +0700 Subject: [PATCH 05/51] Update environment-variables.md Typological error fix for STATSD variable section --- docs/tutorials/environment-variables.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/environment-variables.md b/docs/tutorials/environment-variables.md index a44e977857..9bf761563f 100644 --- a/docs/tutorials/environment-variables.md +++ b/docs/tutorials/environment-variables.md @@ -96,11 +96,11 @@ InfluxDB server TCP port. Default value is: '8086' 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_INFLUXDB_HOST +### _APP_STATSD_HOST StatsD server host name address. Default value is: 'telegraf' -### _APP_INFLUXDB_PORT +### _APP_STATSD_PORT StatsD server TCP port. Default value is: '8125' From 1593838f896dec29c8c61b3b43ef3e3e48bfb01c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 28 Aug 2020 15:20:04 +0300 Subject: [PATCH 06/51] Block iframe access to Appwrite console --- app/controllers/shared/web.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/shared/web.php b/app/controllers/shared/web.php index d7b28de099..3452cd3535 100644 --- a/app/controllers/shared/web.php +++ b/app/controllers/shared/web.php @@ -36,7 +36,9 @@ App::init(function ($utopia, $request, $response, $layout) { $response ->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-UA-Compatible', 'IE=Edge'); // Deny IE browsers from going into quirks mode + ->addHeader('X-Frame-Options', 'SAMEORIGIN') // Avoid console and homepage from showing in iframes + ->addHeader('X-UA-Compatible', 'IE=Edge') // Deny IE browsers from going into quirks mode + ; $route = $utopia->match($request); $scope = $route->getLabel('scope', ''); From c3472eaab93203166c92dfb4fdf99321cfd6aa93 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 28 Aug 2020 15:21:41 +0300 Subject: [PATCH 07/51] Updated changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index e27b89b088..3b3c93ea41 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -59,6 +59,7 @@ - Access to Health API now requires authentication with an API Key with access to `health.read` scope allowed - Added option to force HTTPS connection to the Appwrite server (_APP_OPTIONS_FORCE_HTTPS) - Now using your `_APP_SYSTEM_EMAIL_ADDRESS` as the email address for issuing and renewing SSL certificates +- Block iframe access to Appwrite console using the `X-Frame-Options` header. # Version 0.6.2 (PRE-RELEASE) From 6b5ba93e0797352e6a12d73f0aab3b25bc601fcb Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Fri, 28 Aug 2020 16:32:54 +0300 Subject: [PATCH 08/51] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85626c8d20..2b8905c1ad 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Appwrite Logo

- A complete backend solution for your [Flutter / Vue / Angular / React / iOS / Android / *ANY OTHER*] client app + A complete backend solution for your [Flutter / Vue / Angular / React / iOS / Android / *ANY OTHER*] app

From edde41e50f55b983ddd34374d626ec205fd116a8 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 28 Aug 2020 20:53:19 +0200 Subject: [PATCH 09/51] delete unique key from db --- app/controllers/api/users.php | 4 ++++ src/Appwrite/Database/Adapter.php | 9 +++++++++ src/Appwrite/Database/Adapter/MySQL.php | 22 +++++++++++++++++++++- src/Appwrite/Database/Adapter/Redis.php | 16 ++++++++++++++++ src/Appwrite/Database/Database.php | 12 ++++++++++++ 5 files changed, 62 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 2592076d3f..971396ffc3 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -209,6 +209,10 @@ $utopia->delete('/v1/users/:userId') throw new Exception('Failed to remove user from DB', 500); } + if (!$projectDB->deleteUniqueKey(md5('users:email='.$user->getAttribute('email', null)))) { + throw new Exception('Failed to remove unique key from DB', 500); + } + $reservedId = $projectDB->createDocument([ '$collection' => Database::SYSTEM_COLLECTION_RESERVED, '$id' => $userId, diff --git a/src/Appwrite/Database/Adapter.php b/src/Appwrite/Database/Adapter.php index 6fa79cbdcd..3526256b22 100644 --- a/src/Appwrite/Database/Adapter.php +++ b/src/Appwrite/Database/Adapter.php @@ -88,6 +88,15 @@ abstract class Adapter */ abstract public function deleteDocument($id); + /** + * Delete Unique Key. + * + * @param int $key + * + * @return array + */ + abstract public function deleteUniqueKey($key); + /** * Create Namespace. * diff --git a/src/Appwrite/Database/Adapter/MySQL.php b/src/Appwrite/Database/Adapter/MySQL.php index f766666306..52dd521d9e 100644 --- a/src/Appwrite/Database/Adapter/MySQL.php +++ b/src/Appwrite/Database/Adapter/MySQL.php @@ -191,7 +191,7 @@ class MySQL extends Adapter $st = $this->getPDO()->prepare('INSERT INTO `'.$this->getNamespace().'.database.unique` SET `key` = :key; '); - + $st->bindValue(':key', \md5($data['$collection'].':'.$key.'='.$value), PDO::PARAM_STR); if (!$st->execute()) { @@ -366,6 +366,26 @@ class MySQL extends Adapter return []; } + /** + * Delete Unique Key. + * + * @param int $id + * + * @return array + * + * @throws Exception + */ + public function deleteUniqueKey($key) + { + $st1 = $this->getPDO()->prepare('DELETE FROM `'.$this->getNamespace().'.database.unique` WHERE `key` = :key'); + + $st1->bindValue(':key', $key, PDO::PARAM_STR); + + $st1->execute(); + + return []; + } + /** * Create Relation. * diff --git a/src/Appwrite/Database/Adapter/Redis.php b/src/Appwrite/Database/Adapter/Redis.php index 15a7a887d8..cb35378a9c 100644 --- a/src/Appwrite/Database/Adapter/Redis.php +++ b/src/Appwrite/Database/Adapter/Redis.php @@ -153,6 +153,22 @@ class Redis extends Adapter return $data; } + /** + * Delete Unique Key. + * + * @param $key + * + * @return array + * + * @throws Exception + */ + public function deleteUniqueKey($key) + { + $data = $this->adapter->deleteUniqueKey($key); + + return $data; + } + /** * Create Namespace. * diff --git a/src/Appwrite/Database/Database.php b/src/Appwrite/Database/Database.php index bd61eb3ffd..d6650d3021 100644 --- a/src/Appwrite/Database/Database.php +++ b/src/Appwrite/Database/Database.php @@ -298,6 +298,18 @@ class Database return new Document($this->adapter->deleteDocument($id)); } + /** + * @param int $key + * + * @return Document|false + * + * @throws AuthorizationException + */ + public function deleteUniqueKey($key) + { + return new Document($this->adapter->deleteUniqueKey($key)); + } + /** * @return array */ From d9d32dbf46042270f01029adc725ad02de33e630 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 28 Aug 2020 23:42:24 +0200 Subject: [PATCH 10/51] fix phpdoc entry --- src/Appwrite/Database/Adapter/MySQL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Database/Adapter/MySQL.php b/src/Appwrite/Database/Adapter/MySQL.php index 52dd521d9e..6b2114f145 100644 --- a/src/Appwrite/Database/Adapter/MySQL.php +++ b/src/Appwrite/Database/Adapter/MySQL.php @@ -369,7 +369,7 @@ class MySQL extends Adapter /** * Delete Unique Key. * - * @param int $id + * @param int $key * * @return array * From 532b547f9bdd9e7d5a7f77013ba5bcadec16486e Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 28 Aug 2020 23:56:22 +0200 Subject: [PATCH 11/51] add docs & e2e test --- docs/references/users/delete-user.md | 1 + tests/e2e/Services/Users/UsersBase.php | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 docs/references/users/delete-user.md diff --git a/docs/references/users/delete-user.md b/docs/references/users/delete-user.md new file mode 100644 index 0000000000..7eb4963485 --- /dev/null +++ b/docs/references/users/delete-user.md @@ -0,0 +1 @@ +Delete a user by its unique ID. \ No newline at end of file diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index f66841ce05..c4c99de29e 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -168,6 +168,34 @@ trait UsersBase return $data; } + /** + * @depends testGetUser + */ + public function testDeleteUser(array $data):array + { + /** + * Test for SUCCESS + */ + $user = $this->client->call(Client::METHOD_DELETE, '/users/' . $data['userId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals($user['headers']['status-code'], 204); + + /** + * Test for FAILURE + */ + $user = $this->client->call(Client::METHOD_DELETE, '/users/' . $data['userId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals($user['headers']['status-code'], 404); + + return $data; + } + // TODO add test for session delete // TODO add test for all sessions delete } \ No newline at end of file From 2d107e3ed999bfbc4245c3bbdfb5e21024dcc5ed Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 28 Aug 2020 23:58:31 +0200 Subject: [PATCH 12/51] revert whitespace removal --- src/Appwrite/Database/Adapter/MySQL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Database/Adapter/MySQL.php b/src/Appwrite/Database/Adapter/MySQL.php index 6b2114f145..3d966d165b 100644 --- a/src/Appwrite/Database/Adapter/MySQL.php +++ b/src/Appwrite/Database/Adapter/MySQL.php @@ -191,7 +191,7 @@ class MySQL extends Adapter $st = $this->getPDO()->prepare('INSERT INTO `'.$this->getNamespace().'.database.unique` SET `key` = :key; '); - + $st->bindValue(':key', \md5($data['$collection'].':'.$key.'='.$value), PDO::PARAM_STR); if (!$st->execute()) { From 79ee6c04e83cffbcf06e8e58d208ee2e0de5d886 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 30 Aug 2020 07:49:24 +0300 Subject: [PATCH 13/51] Updated error message --- app/controllers/api/database.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 548905edae..b455106bda 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -66,7 +66,7 @@ App::post('/v1/database/collections') 'rules' => $parsedRules, ]); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) { @@ -266,7 +266,7 @@ App::put('/v1/database/collections/:collectionId') 'rules' => $parsedRules, ])); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) { @@ -404,7 +404,7 @@ App::post('/v1/database/collections/:collectionId/documents') $authorization = new Authorization($parentDocument, 'write'); if (!$authorization->isValid($new->getPermissions())) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } $parentDocument @@ -429,7 +429,7 @@ App::post('/v1/database/collections/:collectionId/documents') try { $data = $projectDB->createDocument($data); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) { @@ -624,7 +624,7 @@ App::patch('/v1/database/collections/:collectionId/documents/:documentId') try { $data = $projectDB->updateDocument($data); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) { @@ -680,7 +680,7 @@ App::delete('/v1/database/collections/:collectionId/documents/:documentId') try { $projectDB->deleteDocument($documentId); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) { From 44fe8310153b6822da0a75edc0d0d249d6e2e074 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 30 Aug 2020 07:53:13 +0300 Subject: [PATCH 14/51] Upgraded swoole version to 4.5.3 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2eeb7f84f3..1a2798c450 100755 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ FROM php:7.4-cli-alpine as step1 ENV TZ=Asia/Tel_Aviv \ PHP_REDIS_VERSION=5.3.0 \ - PHP_SWOOLE_VERSION=4.5.2 \ + PHP_SWOOLE_VERSION=4.5.3 \ PHP_XDEBUG_VERSION=sdebug_2_9-beta RUN \ From 2f904b43848108986567190828ca5654e20482d4 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 30 Aug 2020 09:51:44 +0300 Subject: [PATCH 15/51] Fixed mock API --- app/controllers/mock.php | 45 +++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/app/controllers/mock.php b/app/controllers/mock.php index ea8c179efe..102194d98f 100644 --- a/app/controllers/mock.php +++ b/app/controllers/mock.php @@ -12,6 +12,7 @@ use Appwrite\Storage\Validator\File; App::get('/v1/mock/tests/foo') ->desc('Mock a get request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'foo') ->label('sdk.method', 'get') @@ -25,6 +26,7 @@ App::get('/v1/mock/tests/foo') App::post('/v1/mock/tests/foo') ->desc('Mock a post request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'foo') ->label('sdk.method', 'post') @@ -38,6 +40,7 @@ App::post('/v1/mock/tests/foo') App::patch('/v1/mock/tests/foo') ->desc('Mock a patch request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'foo') ->label('sdk.method', 'patch') @@ -51,6 +54,7 @@ App::patch('/v1/mock/tests/foo') App::put('/v1/mock/tests/foo') ->desc('Mock a put request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'foo') ->label('sdk.method', 'put') @@ -64,6 +68,7 @@ App::put('/v1/mock/tests/foo') App::delete('/v1/mock/tests/foo') ->desc('Mock a delete request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'foo') ->label('sdk.method', 'delete') @@ -77,6 +82,7 @@ App::delete('/v1/mock/tests/foo') App::get('/v1/mock/tests/bar') ->desc('Mock a get request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'bar') ->label('sdk.method', 'get') @@ -90,6 +96,7 @@ App::get('/v1/mock/tests/bar') App::post('/v1/mock/tests/bar') ->desc('Mock a post request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'bar') ->label('sdk.method', 'post') @@ -103,6 +110,7 @@ App::post('/v1/mock/tests/bar') App::patch('/v1/mock/tests/bar') ->desc('Mock a patch request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'bar') ->label('sdk.method', 'patch') @@ -116,6 +124,7 @@ App::patch('/v1/mock/tests/bar') App::put('/v1/mock/tests/bar') ->desc('Mock a put request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'bar') ->label('sdk.method', 'put') @@ -129,6 +138,7 @@ App::put('/v1/mock/tests/bar') App::delete('/v1/mock/tests/bar') ->desc('Mock a delete request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'bar') ->label('sdk.method', 'delete') @@ -142,6 +152,7 @@ App::delete('/v1/mock/tests/bar') App::post('/v1/mock/tests/general/upload') ->desc('Mock a post request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'general') ->label('sdk.method', 'upload') @@ -153,7 +164,7 @@ App::post('/v1/mock/tests/general/upload') ->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('file', [], function () { return new File(); }, 'Sample file param', false) ->action(function ($x, $y, $z, $file, $request) { - /** @var Utopia\Request $request */ + /** @var Utopia\Swoole\Request $request */ $file = $request->getFiles('file'); $file['tmp_name'] = (\is_array($file['tmp_name'])) ? $file['tmp_name'] : [$file['tmp_name']]; @@ -181,19 +192,21 @@ App::post('/v1/mock/tests/general/upload') App::get('/v1/mock/tests/general/redirect') ->desc('Mock a post request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'general') ->label('sdk.method', 'redirect') ->label('sdk.description', 'Mock a redirect request for SDK tests') ->label('sdk.mock', true) ->action(function ($response) { - /** @var Utopia\Response $response */ + /** @var Appwrite\Utopia\Response $response */ $response->redirect('/v1/mock/tests/general/redirected'); }, ['response']); App::get('/v1/mock/tests/general/redirected') ->desc('Mock a post request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'general') ->label('sdk.method', 'redirected') @@ -204,26 +217,28 @@ App::get('/v1/mock/tests/general/redirected') App::get('/v1/mock/tests/general/set-cookie') ->desc('Mock a cookie request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'general') ->label('sdk.method', 'setCookie') ->label('sdk.description', 'Mock a set cookie request for SDK tests') ->label('sdk.mock', true) ->action(function ($response) { - /** @var Utopia\Response $response */ + /** @var Appwrite\Utopia\Response $response */ $response->addCookie('cookieName', 'cookieValue', \time() + 31536000, '/', 'localhost', true, true); }, ['response']); App::get('/v1/mock/tests/general/get-cookie') ->desc('Mock a cookie request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'general') ->label('sdk.method', 'getCookie') ->label('sdk.description', 'Mock a get cookie request for SDK tests') ->label('sdk.mock', true) ->action(function ($request) { - /** @var Utopia\Request $request */ + /** @var Utopia\Swoole\Request $request */ if ($request->getCookie('cookieName', '') !== 'cookieValue') { throw new Exception('Missing cookie value', 400); @@ -232,13 +247,14 @@ App::get('/v1/mock/tests/general/get-cookie') App::get('/v1/mock/tests/general/empty') ->desc('Mock a post request for SDK tests') + ->groups(['mock']) ->label('scope', 'public') ->label('sdk.namespace', 'general') ->label('sdk.method', 'empty') ->label('sdk.description', 'Mock a redirected request for SDK tests') ->label('sdk.mock', true) ->action(function ($response) { - /** @var Utopia\Response $response */ + /** @var Appwrite\Utopia\Response $response */ $response->noContent(); exit(); @@ -246,6 +262,7 @@ App::get('/v1/mock/tests/general/empty') App::get('/v1/mock/tests/general/oauth2') ->desc('Mock an OAuth2 login route') + ->groups(['mock']) ->label('scope', 'public') ->label('docs', false) ->label('sdk.mock', true) @@ -254,13 +271,14 @@ App::get('/v1/mock/tests/general/oauth2') ->param('scope', '', function () { return new Text(100); }, 'OAuth2 scope list.') ->param('state', '', function () { return new Text(1024); }, 'OAuth2 state.') ->action(function ($clientId, $redirectURI, $scope, $state, $response) { - /** @var Utopia\Response $response */ + /** @var Appwrite\Utopia\Response $response */ $response->redirect($redirectURI.'?'.\http_build_query(['code' => 'abcdef', 'state' => $state])); }, ['response']); App::get('/v1/mock/tests/general/oauth2/token') ->desc('Mock an OAuth2 login route') + ->groups(['mock']) ->label('scope', 'public') ->label('docs', false) ->label('sdk.mock', true) @@ -269,7 +287,7 @@ App::get('/v1/mock/tests/general/oauth2/token') ->param('client_secret', '', function () { return new Text(100); }, 'OAuth2 scope list.') ->param('code', '', function () { return new Text(100); }, 'OAuth2 state.') ->action(function ($clientId, $redirectURI, $clientSecret, $code, $response) { - /** @var Utopia\Response $response */ + /** @var Appwrite\Utopia\Response $response */ if ($clientId != '1') { throw new Exception('Invalid client ID'); @@ -288,11 +306,12 @@ App::get('/v1/mock/tests/general/oauth2/token') App::get('/v1/mock/tests/general/oauth2/user') ->desc('Mock an OAuth2 user route') + ->groups(['mock']) ->label('scope', 'public') ->label('docs', false) ->param('token', '', function () { return new Text(100); }, 'OAuth2 Access Token.') ->action(function ($token, $response) { - /** @var Utopia\Response $response */ + /** @var Appwrite\Utopia\Response $response */ if ($token != '123456') { throw new Exception('Invalid token'); @@ -307,9 +326,10 @@ App::get('/v1/mock/tests/general/oauth2/user') App::get('/v1/mock/tests/general/oauth2/success') ->label('scope', 'public') + ->groups(['mock']) ->label('docs', false) ->action(function ($response) { - /** @var Utopia\Response $response */ + /** @var Appwrite\Utopia\Response $response */ $response->json([ 'result' => 'success', @@ -317,10 +337,11 @@ App::get('/v1/mock/tests/general/oauth2/success') }, ['response']); App::get('/v1/mock/tests/general/oauth2/failure') + ->groups(['mock']) ->label('scope', 'public') ->label('docs', false) ->action(function ($response) { - /** @var Utopia\Response $response */ + /** @var Appwrite\Utopia\Response $response */ $response ->setStatusCode(Response::STATUS_CODE_BAD_REQUEST) @@ -331,8 +352,8 @@ App::get('/v1/mock/tests/general/oauth2/failure') App::shutdown(function($utopia, $response, $request) { /** @var Utopia\App $utopia */ - /** @var Utopia\Request $request */ - /** @var Utopia\Response $response */ + /** @var Utopia\Swoole\Request $request */ + /** @var Appwrite\Utopia\Response $response */ $result = []; $route = $utopia->match($request); From 8ccd94d1ec799e0b2fe6f9bd13ac97ed42d3149d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 30 Aug 2020 19:23:15 +0300 Subject: [PATCH 16/51] Swift demo --- app/sdks/client-swift/CHANGELOG.md | 1 + app/sdks/client-swift/LICENSE | 12 + app/sdks/client-swift/Package.swift | 35 ++ app/sdks/client-swift/README.md | 24 + .../Sources/Appwrite/Client.swift | 231 ++++++++ .../Sources/Appwrite/Service.swift | 16 + .../Sources/Appwrite/Services/Account.swift | 491 ++++++++++++++++++ .../Sources/Appwrite/Services/Avatars.swift | 233 +++++++++ .../Sources/Appwrite/Services/Database.swift | 183 +++++++ .../Sources/Appwrite/Services/Locale.swift | 164 ++++++ .../Sources/Appwrite/Services/Storage.swift | 246 +++++++++ .../Sources/Appwrite/Services/Teams.swift | 298 +++++++++++ app/sdks/client-swift/docs/account.md | 240 +++++++++ app/sdks/client-swift/docs/avatars.md | 124 +++++ app/sdks/client-swift/docs/database.md | 90 ++++ .../examples/account/create-o-auth2session.md | 14 + .../docs/examples/account/create-recovery.md | 14 + .../docs/examples/account/create-session.md | 14 + .../examples/account/create-verification.md | 14 + .../docs/examples/account/create.md | 14 + .../docs/examples/account/delete-session.md | 14 + .../docs/examples/account/delete-sessions.md | 14 + .../docs/examples/account/delete.md | 14 + .../docs/examples/account/get-logs.md | 14 + .../docs/examples/account/get-prefs.md | 14 + .../docs/examples/account/get-sessions.md | 14 + .../client-swift/docs/examples/account/get.md | 14 + .../docs/examples/account/update-email.md | 14 + .../docs/examples/account/update-name.md | 14 + .../docs/examples/account/update-password.md | 14 + .../docs/examples/account/update-prefs.md | 14 + .../docs/examples/account/update-recovery.md | 14 + .../examples/account/update-verification.md | 14 + .../docs/examples/avatars/get-browser.md | 14 + .../docs/examples/avatars/get-credit-card.md | 14 + .../docs/examples/avatars/get-favicon.md | 14 + .../docs/examples/avatars/get-flag.md | 14 + .../docs/examples/avatars/get-image.md | 14 + .../docs/examples/avatars/get-initials.md | 14 + .../docs/examples/avatars/get-q-r.md | 14 + .../docs/examples/database/create-document.md | 14 + .../docs/examples/database/delete-document.md | 14 + .../docs/examples/database/get-document.md | 14 + .../docs/examples/database/list-documents.md | 14 + .../docs/examples/database/update-document.md | 14 + .../docs/examples/locale/get-continents.md | 14 + .../docs/examples/locale/get-countries-e-u.md | 14 + .../examples/locale/get-countries-phones.md | 14 + .../docs/examples/locale/get-countries.md | 14 + .../docs/examples/locale/get-currencies.md | 14 + .../docs/examples/locale/get-languages.md | 14 + .../client-swift/docs/examples/locale/get.md | 14 + .../docs/examples/storage/create-file.md | 14 + .../docs/examples/storage/delete-file.md | 14 + .../examples/storage/get-file-download.md | 14 + .../docs/examples/storage/get-file-preview.md | 14 + .../docs/examples/storage/get-file-view.md | 14 + .../docs/examples/storage/get-file.md | 14 + .../docs/examples/storage/list-files.md | 14 + .../docs/examples/storage/update-file.md | 14 + .../docs/examples/teams/create-membership.md | 14 + .../docs/examples/teams/create.md | 14 + .../docs/examples/teams/delete-membership.md | 14 + .../docs/examples/teams/delete.md | 14 + .../docs/examples/teams/get-memberships.md | 14 + .../client-swift/docs/examples/teams/get.md | 14 + .../client-swift/docs/examples/teams/list.md | 14 + .../teams/update-membership-status.md | 14 + .../docs/examples/teams/update.md | 14 + app/sdks/client-swift/docs/locale.md | 64 +++ app/sdks/client-swift/docs/storage.md | 131 +++++ app/sdks/client-swift/docs/teams.md | 153 ++++++ app/tasks/sdks.php | 16 +- composer.lock | 12 +- 74 files changed, 3512 insertions(+), 8 deletions(-) create mode 100644 app/sdks/client-swift/CHANGELOG.md create mode 100644 app/sdks/client-swift/LICENSE create mode 100644 app/sdks/client-swift/Package.swift create mode 100644 app/sdks/client-swift/README.md create mode 100644 app/sdks/client-swift/Sources/Appwrite/Client.swift create mode 100644 app/sdks/client-swift/Sources/Appwrite/Service.swift create mode 100644 app/sdks/client-swift/Sources/Appwrite/Services/Account.swift create mode 100644 app/sdks/client-swift/Sources/Appwrite/Services/Avatars.swift create mode 100644 app/sdks/client-swift/Sources/Appwrite/Services/Database.swift create mode 100644 app/sdks/client-swift/Sources/Appwrite/Services/Locale.swift create mode 100644 app/sdks/client-swift/Sources/Appwrite/Services/Storage.swift create mode 100644 app/sdks/client-swift/Sources/Appwrite/Services/Teams.swift create mode 100644 app/sdks/client-swift/docs/account.md create mode 100644 app/sdks/client-swift/docs/avatars.md create mode 100644 app/sdks/client-swift/docs/database.md create mode 100644 app/sdks/client-swift/docs/examples/account/create-o-auth2session.md create mode 100644 app/sdks/client-swift/docs/examples/account/create-recovery.md create mode 100644 app/sdks/client-swift/docs/examples/account/create-session.md create mode 100644 app/sdks/client-swift/docs/examples/account/create-verification.md create mode 100644 app/sdks/client-swift/docs/examples/account/create.md create mode 100644 app/sdks/client-swift/docs/examples/account/delete-session.md create mode 100644 app/sdks/client-swift/docs/examples/account/delete-sessions.md create mode 100644 app/sdks/client-swift/docs/examples/account/delete.md create mode 100644 app/sdks/client-swift/docs/examples/account/get-logs.md create mode 100644 app/sdks/client-swift/docs/examples/account/get-prefs.md create mode 100644 app/sdks/client-swift/docs/examples/account/get-sessions.md create mode 100644 app/sdks/client-swift/docs/examples/account/get.md create mode 100644 app/sdks/client-swift/docs/examples/account/update-email.md create mode 100644 app/sdks/client-swift/docs/examples/account/update-name.md create mode 100644 app/sdks/client-swift/docs/examples/account/update-password.md create mode 100644 app/sdks/client-swift/docs/examples/account/update-prefs.md create mode 100644 app/sdks/client-swift/docs/examples/account/update-recovery.md create mode 100644 app/sdks/client-swift/docs/examples/account/update-verification.md create mode 100644 app/sdks/client-swift/docs/examples/avatars/get-browser.md create mode 100644 app/sdks/client-swift/docs/examples/avatars/get-credit-card.md create mode 100644 app/sdks/client-swift/docs/examples/avatars/get-favicon.md create mode 100644 app/sdks/client-swift/docs/examples/avatars/get-flag.md create mode 100644 app/sdks/client-swift/docs/examples/avatars/get-image.md create mode 100644 app/sdks/client-swift/docs/examples/avatars/get-initials.md create mode 100644 app/sdks/client-swift/docs/examples/avatars/get-q-r.md create mode 100644 app/sdks/client-swift/docs/examples/database/create-document.md create mode 100644 app/sdks/client-swift/docs/examples/database/delete-document.md create mode 100644 app/sdks/client-swift/docs/examples/database/get-document.md create mode 100644 app/sdks/client-swift/docs/examples/database/list-documents.md create mode 100644 app/sdks/client-swift/docs/examples/database/update-document.md create mode 100644 app/sdks/client-swift/docs/examples/locale/get-continents.md create mode 100644 app/sdks/client-swift/docs/examples/locale/get-countries-e-u.md create mode 100644 app/sdks/client-swift/docs/examples/locale/get-countries-phones.md create mode 100644 app/sdks/client-swift/docs/examples/locale/get-countries.md create mode 100644 app/sdks/client-swift/docs/examples/locale/get-currencies.md create mode 100644 app/sdks/client-swift/docs/examples/locale/get-languages.md create mode 100644 app/sdks/client-swift/docs/examples/locale/get.md create mode 100644 app/sdks/client-swift/docs/examples/storage/create-file.md create mode 100644 app/sdks/client-swift/docs/examples/storage/delete-file.md create mode 100644 app/sdks/client-swift/docs/examples/storage/get-file-download.md create mode 100644 app/sdks/client-swift/docs/examples/storage/get-file-preview.md create mode 100644 app/sdks/client-swift/docs/examples/storage/get-file-view.md create mode 100644 app/sdks/client-swift/docs/examples/storage/get-file.md create mode 100644 app/sdks/client-swift/docs/examples/storage/list-files.md create mode 100644 app/sdks/client-swift/docs/examples/storage/update-file.md create mode 100644 app/sdks/client-swift/docs/examples/teams/create-membership.md create mode 100644 app/sdks/client-swift/docs/examples/teams/create.md create mode 100644 app/sdks/client-swift/docs/examples/teams/delete-membership.md create mode 100644 app/sdks/client-swift/docs/examples/teams/delete.md create mode 100644 app/sdks/client-swift/docs/examples/teams/get-memberships.md create mode 100644 app/sdks/client-swift/docs/examples/teams/get.md create mode 100644 app/sdks/client-swift/docs/examples/teams/list.md create mode 100644 app/sdks/client-swift/docs/examples/teams/update-membership-status.md create mode 100644 app/sdks/client-swift/docs/examples/teams/update.md create mode 100644 app/sdks/client-swift/docs/locale.md create mode 100644 app/sdks/client-swift/docs/storage.md create mode 100644 app/sdks/client-swift/docs/teams.md diff --git a/app/sdks/client-swift/CHANGELOG.md b/app/sdks/client-swift/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/client-swift/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/client-swift/LICENSE b/app/sdks/client-swift/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/client-swift/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 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: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/client-swift/Package.swift b/app/sdks/client-swift/Package.swift new file mode 100644 index 0000000000..5bea7f1c50 --- /dev/null +++ b/app/sdks/client-swift/Package.swift @@ -0,0 +1,35 @@ +// swift-tools-version:5.1 +// The swift-tools-version declares the minimum version of Swift required to build this package. +// +// Created by Armino +// GitHub: https://github.com/armino-dev/sdk-generator +// + +import PackageDescription + +let package = Package( + name: "Appwrite", + products: [ + // Products define the executables and libraries produced by a package, + // and make them visible to other packages. + .library( + name: "Appwrite", + targets: ["Appwrite"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. + // A target can define a module or a test suite. + // Targets can depend on other targets in this package, + // and on products in packages which this package depends on. + .target( + name: "Appwrite", + dependencies: []), + .testTarget( + name: "AppwriteTests", + dependencies: [Appwrite]), + ] +) diff --git a/app/sdks/client-swift/README.md b/app/sdks/client-swift/README.md new file mode 100644 index 0000000000..d46757f068 --- /dev/null +++ b/app/sdks/client-swift/README.md @@ -0,0 +1,24 @@ +# Appwrite Swift SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-swift.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Swift SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +``` + git clone appwrite/sdk-for-swift + cd sdk-for-swift + swift run +``` + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. diff --git a/app/sdks/client-swift/Sources/Appwrite/Client.swift b/app/sdks/client-swift/Sources/Appwrite/Client.swift new file mode 100644 index 0000000000..8748fbc0f9 --- /dev/null +++ b/app/sdks/client-swift/Sources/Appwrite/Client.swift @@ -0,0 +1,231 @@ +// +// Client.swift +// +// Created by Armino +// GitHub: https://github.com/armino-dev/sdk-generator +// + +import Foundation + +open class Client { + + // MARK: Properties + + open var selfSigned = false + + open var endpoint = "https://appwrite.io/v1" + + open var headers: [String: String] = [ + "content-type": "", + "x-sdk-version": "appwrite:swift:" + ] + + + // MARK: Methods + + // default constructor + public init() { + + } + + /// + /// Set Project + /// + /// Your project ID + /// + /// @param String value + /// + /// @return Client + /// + open func setProject(value: String) -> Client { + + self.addHeader(key: "X-Appwrite-Project", value: value) + return self + } + + /// + /// Set Locale + /// + /// @param String value + /// + /// @return Client + /// + open func setLocale(value: String) -> Client { + + self.addHeader(key: "X-Appwrite-Locale", value: value) + return self + } + + + /// + /// @param Bool status + /// @return Client + /// + open func setSelfSigned(status: Bool = true) -> Client { + + self.selfSigned = status + return self + } + + /// + /// @param String endpoint + /// @return Client + /// + open func setEndpoint(endpoint: String) -> Client { + + self.endpoint = endpoint + return self + } + + /// + /// @param String key + /// @param String value + /// + open func addHeader(key: String, value: String) -> Client { + + self.headers[key.lowercased()] = value.lowercased() + + return self + } + + /// + open func httpBuildQuery(params: [String: Any], prefix: String = "") -> String { + var output: String = "" + for (key, value) in params { + let finalKey: String = prefix.isEmpty ? key : (prefix + "[" + key + "]") + if (value is AnyCollection) { + output += self.httpBuildQuery(params: value as! [String : Any], prefix: finalKey) + } else { + output += "\(value)" + } + output += "&" + } + return output + } + + /// + /// Make an API call + /// + /// @param String method + /// @param String path + /// @param Array params + /// @param Array headers + /// @return Array|String + /// @throws Exception + /// + func call(method:String, path:String = "", headers:[String: String] = [:], params:[String: Any] = [:]) -> Any { + + self.headers.merge(headers){(_, new) in new} + let targetURL:URL = URL(string: self.endpoint + path + (( method == HTTPMethod.get.rawValue && !params.isEmpty ) ? "?" + httpBuildQuery(params: params) : ""))! + + var query: String = "" + + var responseStatus: Int = HTTPStatus.unknown.rawValue + var responseType: String = "" + var responseBody: Any = "" + + switch (self.headers["content-type"]) { + case "application/json": + do { + let json = try JSONSerialization.data(withJSONObject:params, options: []) + query = String( data: json, encoding: String.Encoding.utf8)! + } catch { + print("Failed to parse json: \(error.localizedDescription)") + } + break + default: + query = self.httpBuildQuery(params: params) + break + } + + var request = URLRequest(url: targetURL) + let session = URLSession.shared + + for (key, value) in self.headers { + request.setValue(value, forHTTPHeaderField: key) + } + + request.httpMethod = method + if (method.uppercased() == "POST") { + request.httpBody = query.data(using: .utf8) + } + + let semaphore = DispatchSemaphore(value: 0) + + session.dataTask(with: request) { data, response, error in + if (error != nil) { + print(error!) + return + } + do { + let httpResponse = response as! HTTPURLResponse + responseStatus = httpResponse.statusCode + + if (responseStatus == HTTPStatus.internalServerError.rawValue) { + print(responseStatus) + return + } + + responseType = httpResponse.mimeType ?? "" + + if (responseType == "application/json") { + let json = try JSONSerialization.jsonObject(with: data!, options: []) + responseBody = json + } else { + responseBody = String(data: data!, encoding: String.Encoding.utf8)! + } + } catch { + print(error) + } + + semaphore.signal() + }.resume() + + _ = semaphore.wait(wallTimeout: .distantFuture) + + return responseBody + } + +} + +extension Client { + + public enum HTTPStatus: Int { + case unknown = -1 + + case ok = 200 + case created = 201 + case accepted = 202 + + case movedPermanently = 301 + case found = 302 + + case badRequest = 400 + case notAuthorized = 401 + case paymentRequired = 402 + case forbidden = 403 + case notFound = 404 + case methodNotAllowed = 405 + case notAcceptable = 406 + + case internalServerError = 500 + case notImplemented = 501 + } + + public enum HTTPMethod: String { + case get + + case post + case put + case patch + + case delete + + case head + case options + case connect + case trace + } + + +} diff --git a/app/sdks/client-swift/Sources/Appwrite/Service.swift b/app/sdks/client-swift/Sources/Appwrite/Service.swift new file mode 100644 index 0000000000..b11a067a5d --- /dev/null +++ b/app/sdks/client-swift/Sources/Appwrite/Service.swift @@ -0,0 +1,16 @@ +// +// Service.swift +// +// Created by Armino +// GitHub: https://github.com/armino-dev/sdk-generator +// + +open class Service { + + open var client: Client; + + public init(client: Client) + { + self.client = client + } +} diff --git a/app/sdks/client-swift/Sources/Appwrite/Services/Account.swift b/app/sdks/client-swift/Sources/Appwrite/Services/Account.swift new file mode 100644 index 0000000000..0ffb74df52 --- /dev/null +++ b/app/sdks/client-swift/Sources/Appwrite/Services/Account.swift @@ -0,0 +1,491 @@ + + +class Account: Service +{ + /** + * Get Account + * + * Get currently logged in user data as JSON object. + * + * @throws Exception + * @return array + */ + + func get() -> Array { + let path: String = "/account" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow your new user to login + * to his new account, you need to create a new [account + * session](/docs/client/account#createSession). + * + * @param String _email + * @param String _password + * @param String _name + * @throws Exception + * @return array + */ + + func create(_email: String, _password: String, _name: String = "") -> Array { + let path: String = "/account" + + + var params: [String: Any] = [:] + + params["email"] = _email + params["password"] = _password + params["name"] = _name + + return [self.client.call(method: Client.HTTPMethod.post.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Delete Account + * + * Delete a currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. This is done + * to avoid deleted accounts being overtaken by new users with the same email + * address. Any user-related resources like documents or storage files should + * be deleted separately. + * + * @throws Exception + * @return array + */ + + func delete() -> Array { + let path: String = "/account" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.delete.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, user confirmation status is being reset and a new confirmation + * mail is sent. For security measures, user password is required to complete + * this request. + * + * @param String _email + * @param String _password + * @throws Exception + * @return array + */ + + func updateEmail(_email: String, _password: String) -> Array { + let path: String = "/account/email" + + + var params: [String: Any] = [:] + + params["email"] = _email + params["password"] = _password + + return [self.client.call(method: Client.HTTPMethod.patch.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws Exception + * @return array + */ + + func getLogs() -> Array { + let path: String = "/account/logs" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param String _name + * @throws Exception + * @return array + */ + + func updateName(_name: String) -> Array { + let path: String = "/account/name" + + + var params: [String: Any] = [:] + + params["name"] = _name + + return [self.client.call(method: Client.HTTPMethod.patch.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param String _password + * @param String _oldPassword + * @throws Exception + * @return array + */ + + func updatePassword(_password: String, _oldPassword: String) -> Array { + let path: String = "/account/password" + + + var params: [String: Any] = [:] + + params["password"] = _password + params["oldPassword"] = _oldPassword + + return [self.client.call(method: Client.HTTPMethod.patch.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws Exception + * @return array + */ + + func getPrefs() -> Array { + let path: String = "/account/prefs" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param object _prefs + * @throws Exception + * @return array + */ + + func updatePrefs(_prefs: object) -> Array { + let path: String = "/account/prefs" + + + var params: [String: Any] = [:] + + params["prefs"] = _prefs + + return [self.client.call(method: Client.HTTPMethod.patch.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + * endpoint to complete the process. + * + * @param String _email + * @param String _url + * @throws Exception + * @return array + */ + + func createRecovery(_email: String, _url: String) -> Array { + let path: String = "/account/recovery" + + + var params: [String: Any] = [:] + + params["email"] = _email + params["url"] = _url + + return [self.client.call(method: Client.HTTPMethod.post.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Complete Password Recovery + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param String _userId + * @param String _secret + * @param String _password + * @param String _passwordAgain + * @throws Exception + * @return array + */ + + func updateRecovery(_userId: String, _secret: String, _password: String, _passwordAgain: String) -> Array { + let path: String = "/account/recovery" + + + var params: [String: Any] = [:] + + params["userId"] = _userId + params["secret"] = _secret + params["password"] = _password + params["passwordAgain"] = _passwordAgain + + return [self.client.call(method: Client.HTTPMethod.put.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws Exception + * @return array + */ + + func getSessions() -> Array { + let path: String = "/account/sessions" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Create Account Session + * + * Allow the user to login into his account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param String _email + * @param String _password + * @throws Exception + * @return array + */ + + func createSession(_email: String, _password: String) -> Array { + let path: String = "/account/sessions" + + + var params: [String: Any] = [:] + + params["email"] = _email + params["password"] = _password + + return [self.client.call(method: Client.HTTPMethod.post.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws Exception + * @return array + */ + + func deleteSessions() -> Array { + let path: String = "/account/sessions" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.delete.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to his account using the OAuth2 provider of his + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * @param String _provider + * @param String _success + * @param String _failure + * @param Array _scopes + * @throws Exception + * @return array + */ + + func createOAuth2Session(_provider: String, _success: String = "https://appwrite.io/auth/oauth2/success", _failure: String = "https://appwrite.io/auth/oauth2/failure", _scopes: Array = []) -> Array { + var path: String = "/account/sessions/oauth2/{provider}" + + path = path.replacingOccurrences( + of: "{provider}", + with: _provider + ) + + var params: [String: Any] = [:] + + params["success"] = _success + params["failure"] = _failure + params["scopes"] = _scopes + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all his + * account sessions across all his different devices. When using the option id + * argument, only the session unique ID provider will be deleted. + * + * @param String _sessionId + * @throws Exception + * @return array + */ + + func deleteSession(_sessionId: String) -> Array { + var path: String = "/account/sessions/{sessionId}" + + path = path.replacingOccurrences( + of: "{sessionId}", + with: _sessionId + ) + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.delete.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#updateAccountVerification). + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param String _url + * @throws Exception + * @return array + */ + + func createVerification(_url: String) -> Array { + let path: String = "/account/verification" + + + var params: [String: Any] = [:] + + params["url"] = _url + + return [self.client.call(method: Client.HTTPMethod.post.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Complete Email Verification + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param String _userId + * @param String _secret + * @throws Exception + * @return array + */ + + func updateVerification(_userId: String, _secret: String) -> Array { + let path: String = "/account/verification" + + + var params: [String: Any] = [:] + + params["userId"] = _userId + params["secret"] = _secret + + return [self.client.call(method: Client.HTTPMethod.put.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + +} diff --git a/app/sdks/client-swift/Sources/Appwrite/Services/Avatars.swift b/app/sdks/client-swift/Sources/Appwrite/Services/Avatars.swift new file mode 100644 index 0000000000..867841bafd --- /dev/null +++ b/app/sdks/client-swift/Sources/Appwrite/Services/Avatars.swift @@ -0,0 +1,233 @@ + + +class Avatars: Service +{ + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param String _code + * @param Int _width + * @param Int _height + * @param Int _quality + * @throws Exception + * @return array + */ + + func getBrowser(_code: String, _width: Int = 100, _height: Int = 100, _quality: Int = 100) -> Array { + var path: String = "/avatars/browsers/{code}" + + path = path.replacingOccurrences( + of: "{code}", + with: _code + ) + + var params: [String: Any] = [:] + + params["width"] = _width + params["height"] = _height + params["quality"] = _quality + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param String _code + * @param Int _width + * @param Int _height + * @param Int _quality + * @throws Exception + * @return array + */ + + func getCreditCard(_code: String, _width: Int = 100, _height: Int = 100, _quality: Int = 100) -> Array { + var path: String = "/avatars/credit-cards/{code}" + + path = path.replacingOccurrences( + of: "{code}", + with: _code + ) + + var params: [String: Any] = [:] + + params["width"] = _width + params["height"] = _height + params["quality"] = _quality + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + * website URL. + * + * @param String _url + * @throws Exception + * @return array + */ + + func getFavicon(_url: String) -> Array { + let path: String = "/avatars/favicon" + + + var params: [String: Any] = [:] + + params["url"] = _url + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param String _code + * @param Int _width + * @param Int _height + * @param Int _quality + * @throws Exception + * @return array + */ + + func getFlag(_code: String, _width: Int = 100, _height: Int = 100, _quality: Int = 100) -> Array { + var path: String = "/avatars/flags/{code}" + + path = path.replacingOccurrences( + of: "{code}", + with: _code + ) + + var params: [String: Any] = [:] + + params["width"] = _width + params["height"] = _height + params["quality"] = _quality + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param String _url + * @param Int _width + * @param Int _height + * @throws Exception + * @return array + */ + + func getImage(_url: String, _width: Int = 400, _height: Int = 400) -> Array { + let path: String = "/avatars/image" + + + var params: [String: Any] = [:] + + params["url"] = _url + params["width"] = _width + params["height"] = _height + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param String _name + * @param Int _width + * @param Int _height + * @param String _color + * @param String _background + * @throws Exception + * @return array + */ + + func getInitials(_name: String = "", _width: Int = 500, _height: Int = 500, _color: String = "", _background: String = "") -> Array { + let path: String = "/avatars/initials" + + + var params: [String: Any] = [:] + + params["name"] = _name + params["width"] = _width + params["height"] = _height + params["color"] = _color + params["background"] = _background + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get QR Code + * + * Converts a given plain text to a QR code image. You can use the query + * parameters to change the size and style of the resulting image. + * + * @param String _text + * @param Int _size + * @param Int _margin + * @param Bool _download + * @throws Exception + * @return array + */ + + func getQR(_text: String, _size: Int = 400, _margin: Int = 1, _download: Bool = false) -> Array { + let path: String = "/avatars/qr" + + + var params: [String: Any] = [:] + + params["text"] = _text + params["size"] = _size + params["margin"] = _margin + params["download"] = _download + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + +} diff --git a/app/sdks/client-swift/Sources/Appwrite/Services/Database.swift b/app/sdks/client-swift/Sources/Appwrite/Services/Database.swift new file mode 100644 index 0000000000..8436985582 --- /dev/null +++ b/app/sdks/client-swift/Sources/Appwrite/Services/Database.swift @@ -0,0 +1,183 @@ + + +class Database: Service +{ + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param String _collectionId + * @param Array _filters + * @param Int _limit + * @param Int _offset + * @param String _orderField + * @param String _orderType + * @param String _orderCast + * @param String _search + * @throws Exception + * @return array + */ + + func listDocuments(_collectionId: String, _filters: Array = [], _limit: Int = 25, _offset: Int = 0, _orderField: String = "$id", _orderType: String = "ASC", _orderCast: String = "string", _search: String = "") -> Array { + var path: String = "/database/collections/{collectionId}/documents" + + path = path.replacingOccurrences( + of: "{collectionId}", + with: _collectionId + ) + + var params: [String: Any] = [:] + + params["filters"] = _filters + params["limit"] = _limit + params["offset"] = _offset + params["orderField"] = _orderField + params["orderType"] = _orderType + params["orderCast"] = _orderCast + params["search"] = _search + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param String _collectionId + * @param object _data + * @param Array _read + * @param Array _write + * @throws Exception + * @return array + */ + + func createDocument(_collectionId: String, _data: object, _read: Array, _write: Array) -> Array { + var path: String = "/database/collections/{collectionId}/documents" + + path = path.replacingOccurrences( + of: "{collectionId}", + with: _collectionId + ) + + var params: [String: Any] = [:] + + params["data"] = _data + params["read"] = _read + params["write"] = _write + + return [self.client.call(method: Client.HTTPMethod.post.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param String _collectionId + * @param String _documentId + * @throws Exception + * @return array + */ + + func getDocument(_collectionId: String, _documentId: String) -> Array { + var path: String = "/database/collections/{collectionId}/documents/{documentId}" + + path = path.replacingOccurrences( + of: "{collectionId}", + with: _collectionId + ) + path = path.replacingOccurrences( + of: "{documentId}", + with: _documentId + ) + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Update Document + * + * @param String _collectionId + * @param String _documentId + * @param object _data + * @param Array _read + * @param Array _write + * @throws Exception + * @return array + */ + + func updateDocument(_collectionId: String, _documentId: String, _data: object, _read: Array, _write: Array) -> Array { + var path: String = "/database/collections/{collectionId}/documents/{documentId}" + + path = path.replacingOccurrences( + of: "{collectionId}", + with: _collectionId + ) + path = path.replacingOccurrences( + of: "{documentId}", + with: _documentId + ) + + var params: [String: Any] = [:] + + params["data"] = _data + params["read"] = _read + params["write"] = _write + + return [self.client.call(method: Client.HTTPMethod.patch.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, his attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param String _collectionId + * @param String _documentId + * @throws Exception + * @return array + */ + + func deleteDocument(_collectionId: String, _documentId: String) -> Array { + var path: String = "/database/collections/{collectionId}/documents/{documentId}" + + path = path.replacingOccurrences( + of: "{collectionId}", + with: _collectionId + ) + path = path.replacingOccurrences( + of: "{documentId}", + with: _documentId + ) + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.delete.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + +} diff --git a/app/sdks/client-swift/Sources/Appwrite/Services/Locale.swift b/app/sdks/client-swift/Sources/Appwrite/Services/Locale.swift new file mode 100644 index 0000000000..ef21554cbc --- /dev/null +++ b/app/sdks/client-swift/Sources/Appwrite/Services/Locale.swift @@ -0,0 +1,164 @@ + + +class Locale: Service +{ + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws Exception + * @return array + */ + + func get() -> Array { + let path: String = "/locale" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return array + */ + + func getContinents() -> Array { + let path: String = "/locale/continents" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return array + */ + + func getCountries() -> Array { + let path: String = "/locale/countries" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws Exception + * @return array + */ + + func getCountriesEU() -> Array { + let path: String = "/locale/countries/eu" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws Exception + * @return array + */ + + func getCountriesPhones() -> Array { + let path: String = "/locale/countries/phones" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws Exception + * @return array + */ + + func getCurrencies() -> Array { + let path: String = "/locale/currencies" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws Exception + * @return array + */ + + func getLanguages() -> Array { + let path: String = "/locale/languages" + + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + +} diff --git a/app/sdks/client-swift/Sources/Appwrite/Services/Storage.swift b/app/sdks/client-swift/Sources/Appwrite/Services/Storage.swift new file mode 100644 index 0000000000..b6e98145f7 --- /dev/null +++ b/app/sdks/client-swift/Sources/Appwrite/Services/Storage.swift @@ -0,0 +1,246 @@ + + +class Storage: Service +{ + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param String _search + * @param Int _limit + * @param Int _offset + * @param String _orderType + * @throws Exception + * @return array + */ + + func listFiles(_search: String = "", _limit: Int = 25, _offset: Int = 0, _orderType: String = "ASC") -> Array { + let path: String = "/storage/files" + + + var params: [String: Any] = [:] + + params["search"] = _search + params["limit"] = _limit + params["offset"] = _offset + params["orderType"] = _orderType + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param Array _file + * @param Array _read + * @param Array _write + * @throws Exception + * @return array + */ + + func createFile(_file: Array, _read: Array, _write: Array) -> Array { + let path: String = "/storage/files" + + + var params: [String: Any] = [:] + + params["file"] = _file + params["read"] = _read + params["write"] = _write + + return [self.client.call(method: Client.HTTPMethod.post.rawValue, path: path, headers: [ + "content-type": "multipart/form-data", + ], params: params)]; + } + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param String _fileId + * @throws Exception + * @return array + */ + + func getFile(_fileId: String) -> Array { + var path: String = "/storage/files/{fileId}" + + path = path.replacingOccurrences( + of: "{fileId}", + with: _fileId + ) + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param String _fileId + * @param Array _read + * @param Array _write + * @throws Exception + * @return array + */ + + func updateFile(_fileId: String, _read: Array, _write: Array) -> Array { + var path: String = "/storage/files/{fileId}" + + path = path.replacingOccurrences( + of: "{fileId}", + with: _fileId + ) + + var params: [String: Any] = [:] + + params["read"] = _read + params["write"] = _write + + return [self.client.call(method: Client.HTTPMethod.put.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param String _fileId + * @throws Exception + * @return array + */ + + func deleteFile(_fileId: String) -> Array { + var path: String = "/storage/files/{fileId}" + + path = path.replacingOccurrences( + of: "{fileId}", + with: _fileId + ) + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.delete.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param String _fileId + * @throws Exception + * @return array + */ + + func getFileDownload(_fileId: String) -> Array { + var path: String = "/storage/files/{fileId}/download" + + path = path.replacingOccurrences( + of: "{fileId}", + with: _fileId + ) + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param String _fileId + * @param Int _width + * @param Int _height + * @param Int _quality + * @param String _background + * @param String _output + * @throws Exception + * @return array + */ + + func getFilePreview(_fileId: String, _width: Int = 0, _height: Int = 0, _quality: Int = 100, _background: String = "", _output: String = "") -> Array { + var path: String = "/storage/files/{fileId}/preview" + + path = path.replacingOccurrences( + of: "{fileId}", + with: _fileId + ) + + var params: [String: Any] = [:] + + params["width"] = _width + params["height"] = _height + params["quality"] = _quality + params["background"] = _background + params["output"] = _output + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param String _fileId + * @param String _as + * @throws Exception + * @return array + */ + + func getFileView(_fileId: String, _as: String = "") -> Array { + var path: String = "/storage/files/{fileId}/view" + + path = path.replacingOccurrences( + of: "{fileId}", + with: _fileId + ) + + var params: [String: Any] = [:] + + params["as"] = _as + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + +} diff --git a/app/sdks/client-swift/Sources/Appwrite/Services/Teams.swift b/app/sdks/client-swift/Sources/Appwrite/Services/Teams.swift new file mode 100644 index 0000000000..50bee60273 --- /dev/null +++ b/app/sdks/client-swift/Sources/Appwrite/Services/Teams.swift @@ -0,0 +1,298 @@ + + +class Teams: Service +{ + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param String _search + * @param Int _limit + * @param Int _offset + * @param String _orderType + * @throws Exception + * @return array + */ + + func list(_search: String = "", _limit: Int = 25, _offset: Int = 0, _orderType: String = "ASC") -> Array { + let path: String = "/teams" + + + var params: [String: Any] = [:] + + params["search"] = _search + params["limit"] = _limit + params["offset"] = _offset + params["orderType"] = _orderType + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param String _name + * @param Array _roles + * @throws Exception + * @return array + */ + + func create(_name: String, _roles: Array = ["owner"]) -> Array { + let path: String = "/teams" + + + var params: [String: Any] = [:] + + params["name"] = _name + params["roles"] = _roles + + return [self.client.call(method: Client.HTTPMethod.post.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param String _teamId + * @throws Exception + * @return array + */ + + func get(_teamId: String) -> Array { + var path: String = "/teams/{teamId}" + + path = path.replacingOccurrences( + of: "{teamId}", + with: _teamId + ) + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param String _teamId + * @param String _name + * @throws Exception + * @return array + */ + + func update(_teamId: String, _name: String) -> Array { + var path: String = "/teams/{teamId}" + + path = path.replacingOccurrences( + of: "{teamId}", + with: _teamId + ) + + var params: [String: Any] = [:] + + params["name"] = _name + + return [self.client.call(method: Client.HTTPMethod.put.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param String _teamId + * @throws Exception + * @return array + */ + + func delete(_teamId: String) -> Array { + var path: String = "/teams/{teamId}" + + path = path.replacingOccurrences( + of: "{teamId}", + with: _teamId + ) + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.delete.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param String _teamId + * @param String _search + * @param Int _limit + * @param Int _offset + * @param String _orderType + * @throws Exception + * @return array + */ + + func getMemberships(_teamId: String, _search: String = "", _limit: Int = 25, _offset: Int = 0, _orderType: String = "ASC") -> Array { + var path: String = "/teams/{teamId}/memberships" + + path = path.replacingOccurrences( + of: "{teamId}", + with: _teamId + ) + + var params: [String: Any] = [:] + + params["search"] = _search + params["limit"] = _limit + params["offset"] = _offset + params["orderType"] = _orderType + + return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param String _teamId + * @param String _email + * @param Array _roles + * @param String _url + * @param String _name + * @throws Exception + * @return array + */ + + func createMembership(_teamId: String, _email: String, _roles: Array, _url: String, _name: String = "") -> Array { + var path: String = "/teams/{teamId}/memberships" + + path = path.replacingOccurrences( + of: "{teamId}", + with: _teamId + ) + + var params: [String: Any] = [:] + + params["email"] = _email + params["name"] = _name + params["roles"] = _roles + params["url"] = _url + + return [self.client.call(method: Client.HTTPMethod.post.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if he didn't accept it. + * + * @param String _teamId + * @param String _inviteId + * @throws Exception + * @return array + */ + + func deleteMembership(_teamId: String, _inviteId: String) -> Array { + var path: String = "/teams/{teamId}/memberships/{inviteId}" + + path = path.replacingOccurrences( + of: "{teamId}", + with: _teamId + ) + path = path.replacingOccurrences( + of: "{inviteId}", + with: _inviteId + ) + + let params: [String: Any] = [:] + + + return [self.client.call(method: Client.HTTPMethod.delete.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + + /** + * Update Team Membership Status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after he is being redirected back to your app from the invitation email he + * was sent. + * + * @param String _teamId + * @param String _inviteId + * @param String _userId + * @param String _secret + * @throws Exception + * @return array + */ + + func updateMembershipStatus(_teamId: String, _inviteId: String, _userId: String, _secret: String) -> Array { + var path: String = "/teams/{teamId}/memberships/{inviteId}/status" + + path = path.replacingOccurrences( + of: "{teamId}", + with: _teamId + ) + path = path.replacingOccurrences( + of: "{inviteId}", + with: _inviteId + ) + + var params: [String: Any] = [:] + + params["userId"] = _userId + params["secret"] = _secret + + return [self.client.call(method: Client.HTTPMethod.patch.rawValue, path: path, headers: [ + "content-type": "application/json", + ], params: params)]; + } + +} diff --git a/app/sdks/client-swift/docs/account.md b/app/sdks/client-swift/docs/account.md new file mode 100644 index 0000000000..48bc91d213 --- /dev/null +++ b/app/sdks/client-swift/docs/account.md @@ -0,0 +1,240 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + +# Account Service + +## Get Account + +```http request +GET https://appwrite.io/v1/account +``` + +** Get currently logged in user data as JSON object. ** + +## Create Account + +```http request +POST https://appwrite.io/v1/account +``` + +** Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](/docs/client/account#createVerification) route to start verifying the user email address. To allow your new user to login to his new account, you need to create a new [account session](/docs/client/account#createSession). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| email | string | User email. | | +| password | string | User password. Must be between 6 to 32 chars. | | +| name | string | User name. | | + +## Delete Account + +```http request +DELETE https://appwrite.io/v1/account +``` + +** Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately. ** + +## Update Account Email + +```http request +PATCH https://appwrite.io/v1/account/email +``` + +** Update currently logged in user account email address. After changing user address, user confirmation status is being reset and a new confirmation mail is sent. For security measures, user password is required to complete this request. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| email | string | User email. | | +| password | string | User password. Must be between 6 to 32 chars. | | + +## Get Account Logs + +```http request +GET https://appwrite.io/v1/account/logs +``` + +** Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log. ** + +## Update Account Name + +```http request +PATCH https://appwrite.io/v1/account/name +``` + +** Update currently logged in user account name. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | User name. | | + +## Update Account Password + +```http request +PATCH https://appwrite.io/v1/account/password +``` + +** Update currently logged in user password. For validation, user is required to pass the password twice. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| password | string | New user password. Must be between 6 to 32 chars. | | +| oldPassword | string | Old user password. Must be between 6 to 32 chars. | | + +## Get Account Preferences + +```http request +GET https://appwrite.io/v1/account/prefs +``` + +** Get currently logged in user preferences as a key-value object. ** + +## Update Account Preferences + +```http request +PATCH https://appwrite.io/v1/account/prefs +``` + +** Update currently logged in user account preferences. You can pass only the specific settings you wish to update. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| prefs | object | Prefs key-value JSON object. | | + +## Create Password Recovery + +```http request +POST https://appwrite.io/v1/account/recovery +``` + +** Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](/docs/client/account#updateRecovery) endpoint to complete the process. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| email | string | User email. | | +| url | string | URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | + +## Complete Password Recovery + +```http request +PUT https://appwrite.io/v1/account/recovery +``` + +** Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](/docs/client/account#createRecovery) endpoint. + +Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User account UID address. | | +| secret | string | Valid reset token. | | +| password | string | New password. Must be between 6 to 32 chars. | | +| passwordAgain | string | New password again. Must be between 6 to 32 chars. | | + +## Get Account Sessions + +```http request +GET https://appwrite.io/v1/account/sessions +``` + +** Get currently logged in user list of active sessions across different devices. ** + +## Create Account Session + +```http request +POST https://appwrite.io/v1/account/sessions +``` + +** Allow the user to login into his account by providing a valid email and password combination. This route will create a new session for the user. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| email | string | User email. | | +| password | string | User password. Must be between 6 to 32 chars. | | + +## Delete All Account Sessions + +```http request +DELETE https://appwrite.io/v1/account/sessions +``` + +** Delete all sessions from the user account and remove any sessions cookies from the end client. ** + +## Create Account Session with OAuth2 + +```http request +GET https://appwrite.io/v1/account/sessions/oauth2/{provider} +``` + +** Allow the user to login to his account using the OAuth2 provider of his choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, bitbucket, bitly, box, discord, dropbox, facebook, github, gitlab, google, linkedin, microsoft, paypal, paypalSandbox, salesforce, slack, spotify, twitch, vk, yahoo, yandex. | | +| success | string | URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | https://appwrite.io/auth/oauth2/success | +| failure | string | URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | https://appwrite.io/auth/oauth2/failure | +| scopes | array | A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. | [] | + +## Delete Account Session + +```http request +DELETE https://appwrite.io/v1/account/sessions/{sessionId} +``` + +** Use this endpoint to log out the currently logged in user from all his account sessions across all his different devices. When using the option id argument, only the session unique ID provider will be deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| sessionId | string | **Required** Session unique ID. Use the string 'current' to delete the current device session. | | + +## Create Email Verification + +```http request +POST https://appwrite.io/v1/account/verification +``` + +** Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](/docs/client/account#updateAccountVerification). + +Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| url | string | URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | + +## Complete Email Verification + +```http request +PUT https://appwrite.io/v1/account/verification +``` + +** Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User unique ID. | | +| secret | string | Valid verification token. | | + diff --git a/app/sdks/client-swift/docs/avatars.md b/app/sdks/client-swift/docs/avatars.md new file mode 100644 index 0000000000..1e17a8e14a --- /dev/null +++ b/app/sdks/client-swift/docs/avatars.md @@ -0,0 +1,124 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + +# Avatars Service + +## Get Browser Icon + +```http request +GET https://appwrite.io/v1/avatars/browsers/{code} +``` + +** You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user /account/sessions endpoint. Use width, height and quality arguments to change the output settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| code | string | **Required** Browser Code. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | + +## Get Credit Card Icon + +```http request +GET https://appwrite.io/v1/avatars/credit-cards/{code} +``` + +** Need to display your users with your billing method or their payment methods? The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| code | string | **Required** Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | + +## Get Favicon + +```http request +GET https://appwrite.io/v1/avatars/favicon +``` + +** Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote website URL. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| url | string | **Required** Website URL which you want to fetch the favicon from. | | + +## Get Country Flag + +```http request +GET https://appwrite.io/v1/avatars/flags/{code} +``` + +** You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| code | string | **Required** Country Code. ISO Alpha-2 country code format. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | + +## Get Image from URL + +```http request +GET https://appwrite.io/v1/avatars/image +``` + +** Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| url | string | **Required** Image URL which you want to crop. | | +| width | integer | Resize preview image width, Pass an integer between 0 to 2000. | 400 | +| height | integer | Resize preview image height, Pass an integer between 0 to 2000. | 400 | + +## Get User Initials + +```http request +GET https://appwrite.io/v1/avatars/initials +``` + +** Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. + +You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Full Name. When empty, current user name or email will be used. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 500 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 500 | +| color | string | Changes text color. By default a random color will be picked and stay will persistent to the given name. | | +| background | string | Changes background color. By default a random color will be picked and stay will persistent to the given name. | | + +## Get QR Code + +```http request +GET https://appwrite.io/v1/avatars/qr +``` + +** Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| text | string | **Required** Plain text to be converted to QR code image. | | +| size | integer | QR code size. Pass an integer between 0 to 1000. Defaults to 400. | 400 | +| margin | integer | Margin from edge. Pass an integer between 0 to 10. Defaults to 1. | 1 | +| download | boolean | Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. | | + diff --git a/app/sdks/client-swift/docs/database.md b/app/sdks/client-swift/docs/database.md new file mode 100644 index 0000000000..d734cb3c1c --- /dev/null +++ b/app/sdks/client-swift/docs/database.md @@ -0,0 +1,90 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + +# Database Service + +## List Documents + +```http request +GET https://appwrite.io/v1/database/collections/{collectionId}/documents +``` + +** Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project documents. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| filters | array | Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'. | [] | +| limit | integer | Maximum number of documents to return in response. Use this value to manage pagination. | 25 | +| offset | integer | Offset value. Use this value to manage pagination. | 0 | +| orderField | string | Document field that results will be sorted by. | $id | +| orderType | string | Order direction. Possible values are DESC for descending order, or ASC for ascending order. | ASC | +| orderCast | string | Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string. | string | +| search | string | Search query. Enter any free text search. The database will try to find a match against all document attributes and children. | | + +## Create Document + +```http request +POST https://appwrite.io/v1/database/collections/{collectionId}/documents +``` + +** Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](/docs/server/database?sdk=nodejs#createCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| data | object | Document data as JSON object. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Get Document + +```http request +GET https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} +``` + +** Get document by its unique ID. This endpoint response returns a JSON object with the document data. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| documentId | string | **Required** Document unique ID. | | + +## Update Document + +```http request +PATCH https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| documentId | string | **Required** Document unique ID. | | +| data | object | Document data as JSON object. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Delete Document + +```http request +DELETE https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} +``` + +** Delete document by its unique ID. This endpoint deletes only the parent documents, his attributes and relations to other documents. Child documents **will not** be deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| documentId | string | **Required** Document unique ID. | | + diff --git a/app/sdks/client-swift/docs/examples/account/create-o-auth2session.md b/app/sdks/client-swift/docs/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..0b67257890 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/create-o-auth2session.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.createOAuth2Session(_provider: "amazon"); diff --git a/app/sdks/client-swift/docs/examples/account/create-recovery.md b/app/sdks/client-swift/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..04fdcae541 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/create-recovery.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.createRecovery(_email: "email@example.com", _url: "https://example.com"); diff --git a/app/sdks/client-swift/docs/examples/account/create-session.md b/app/sdks/client-swift/docs/examples/account/create-session.md new file mode 100644 index 0000000000..477b20199c --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/create-session.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.createSession(_email: "email@example.com", _password: "password"); diff --git a/app/sdks/client-swift/docs/examples/account/create-verification.md b/app/sdks/client-swift/docs/examples/account/create-verification.md new file mode 100644 index 0000000000..b0f8d6444e --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/create-verification.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.createVerification(_url: "https://example.com"); diff --git a/app/sdks/client-swift/docs/examples/account/create.md b/app/sdks/client-swift/docs/examples/account/create.md new file mode 100644 index 0000000000..176b192c5e --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/create.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.create(_email: "email@example.com", _password: "password"); diff --git a/app/sdks/client-swift/docs/examples/account/delete-session.md b/app/sdks/client-swift/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..6f2373dc79 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/delete-session.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.deleteSession(_sessionId: "[SESSION_ID]"); diff --git a/app/sdks/client-swift/docs/examples/account/delete-sessions.md b/app/sdks/client-swift/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..6df71814c6 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/delete-sessions.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.deleteSessions(); diff --git a/app/sdks/client-swift/docs/examples/account/delete.md b/app/sdks/client-swift/docs/examples/account/delete.md new file mode 100644 index 0000000000..f4123b0197 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/delete.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.delete(); diff --git a/app/sdks/client-swift/docs/examples/account/get-logs.md b/app/sdks/client-swift/docs/examples/account/get-logs.md new file mode 100644 index 0000000000..8d3d965723 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/get-logs.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.getLogs(); diff --git a/app/sdks/client-swift/docs/examples/account/get-prefs.md b/app/sdks/client-swift/docs/examples/account/get-prefs.md new file mode 100644 index 0000000000..e9746ab34b --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/get-prefs.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.getPrefs(); diff --git a/app/sdks/client-swift/docs/examples/account/get-sessions.md b/app/sdks/client-swift/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..988e91c8e5 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/get-sessions.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.getSessions(); diff --git a/app/sdks/client-swift/docs/examples/account/get.md b/app/sdks/client-swift/docs/examples/account/get.md new file mode 100644 index 0000000000..b84096bdb8 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/get.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.get(); diff --git a/app/sdks/client-swift/docs/examples/account/update-email.md b/app/sdks/client-swift/docs/examples/account/update-email.md new file mode 100644 index 0000000000..cec700b330 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/update-email.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.updateEmail(_email: "email@example.com", _password: "password"); diff --git a/app/sdks/client-swift/docs/examples/account/update-name.md b/app/sdks/client-swift/docs/examples/account/update-name.md new file mode 100644 index 0000000000..dbc6f7d2b8 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/update-name.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.updateName(_name: "[NAME]"); diff --git a/app/sdks/client-swift/docs/examples/account/update-password.md b/app/sdks/client-swift/docs/examples/account/update-password.md new file mode 100644 index 0000000000..1346102a32 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/update-password.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.updatePassword(_password: "password", _oldPassword: "password"); diff --git a/app/sdks/client-swift/docs/examples/account/update-prefs.md b/app/sdks/client-swift/docs/examples/account/update-prefs.md new file mode 100644 index 0000000000..fea1a8d6ff --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/update-prefs.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.updatePrefs(_prefs: ); diff --git a/app/sdks/client-swift/docs/examples/account/update-recovery.md b/app/sdks/client-swift/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..6009d62e2c --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/update-recovery.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.updateRecovery(_userId: "[USER_ID]", _secret: "[SECRET]", _password: "password", _passwordAgain: "password"); diff --git a/app/sdks/client-swift/docs/examples/account/update-verification.md b/app/sdks/client-swift/docs/examples/account/update-verification.md new file mode 100644 index 0000000000..376a87a9c3 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/account/update-verification.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var account: Account = Account(client: client); + +var result = account.updateVerification(_userId: "[USER_ID]", _secret: "[SECRET]"); diff --git a/app/sdks/client-swift/docs/examples/avatars/get-browser.md b/app/sdks/client-swift/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..874ef96d31 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/avatars/get-browser.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var avatars: Avatars = Avatars(client: client); + +var result = avatars.getBrowser(_code: "aa"); diff --git a/app/sdks/client-swift/docs/examples/avatars/get-credit-card.md b/app/sdks/client-swift/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..797431f3dc --- /dev/null +++ b/app/sdks/client-swift/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var avatars: Avatars = Avatars(client: client); + +var result = avatars.getCreditCard(_code: "amex"); diff --git a/app/sdks/client-swift/docs/examples/avatars/get-favicon.md b/app/sdks/client-swift/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..5623468481 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/avatars/get-favicon.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var avatars: Avatars = Avatars(client: client); + +var result = avatars.getFavicon(_url: "https://example.com"); diff --git a/app/sdks/client-swift/docs/examples/avatars/get-flag.md b/app/sdks/client-swift/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..fba93ae4d4 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/avatars/get-flag.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var avatars: Avatars = Avatars(client: client); + +var result = avatars.getFlag(_code: "af"); diff --git a/app/sdks/client-swift/docs/examples/avatars/get-image.md b/app/sdks/client-swift/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..4ebe561b3b --- /dev/null +++ b/app/sdks/client-swift/docs/examples/avatars/get-image.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var avatars: Avatars = Avatars(client: client); + +var result = avatars.getImage(_url: "https://example.com"); diff --git a/app/sdks/client-swift/docs/examples/avatars/get-initials.md b/app/sdks/client-swift/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..d317cfc5a8 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/avatars/get-initials.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var avatars: Avatars = Avatars(client: client); + +var result = avatars.getInitials(); diff --git a/app/sdks/client-swift/docs/examples/avatars/get-q-r.md b/app/sdks/client-swift/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..737acfc258 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/avatars/get-q-r.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var avatars: Avatars = Avatars(client: client); + +var result = avatars.getQR(_text: "[TEXT]"); diff --git a/app/sdks/client-swift/docs/examples/database/create-document.md b/app/sdks/client-swift/docs/examples/database/create-document.md new file mode 100644 index 0000000000..ebd59adc47 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/database/create-document.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var database: Database = Database(client: client); + +var result = database.createDocument(_collectionId: "[COLLECTION_ID]", _data: , _read: [], _write: []); diff --git a/app/sdks/client-swift/docs/examples/database/delete-document.md b/app/sdks/client-swift/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..faec2ceee9 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/database/delete-document.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var database: Database = Database(client: client); + +var result = database.deleteDocument(_collectionId: "[COLLECTION_ID]", _documentId: "[DOCUMENT_ID]"); diff --git a/app/sdks/client-swift/docs/examples/database/get-document.md b/app/sdks/client-swift/docs/examples/database/get-document.md new file mode 100644 index 0000000000..0f3a05bfa5 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/database/get-document.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var database: Database = Database(client: client); + +var result = database.getDocument(_collectionId: "[COLLECTION_ID]", _documentId: "[DOCUMENT_ID]"); diff --git a/app/sdks/client-swift/docs/examples/database/list-documents.md b/app/sdks/client-swift/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..2c9f4a2efa --- /dev/null +++ b/app/sdks/client-swift/docs/examples/database/list-documents.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var database: Database = Database(client: client); + +var result = database.listDocuments(_collectionId: "[COLLECTION_ID]"); diff --git a/app/sdks/client-swift/docs/examples/database/update-document.md b/app/sdks/client-swift/docs/examples/database/update-document.md new file mode 100644 index 0000000000..bddaf61111 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/database/update-document.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var database: Database = Database(client: client); + +var result = database.updateDocument(_collectionId: "[COLLECTION_ID]", _documentId: "[DOCUMENT_ID]", _data: , _read: [], _write: []); diff --git a/app/sdks/client-swift/docs/examples/locale/get-continents.md b/app/sdks/client-swift/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..3f57d5eb0d --- /dev/null +++ b/app/sdks/client-swift/docs/examples/locale/get-continents.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var locale: Locale = Locale(client: client); + +var result = locale.getContinents(); diff --git a/app/sdks/client-swift/docs/examples/locale/get-countries-e-u.md b/app/sdks/client-swift/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..9f2a26213c --- /dev/null +++ b/app/sdks/client-swift/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var locale: Locale = Locale(client: client); + +var result = locale.getCountriesEU(); diff --git a/app/sdks/client-swift/docs/examples/locale/get-countries-phones.md b/app/sdks/client-swift/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..2cc9c4a9a0 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var locale: Locale = Locale(client: client); + +var result = locale.getCountriesPhones(); diff --git a/app/sdks/client-swift/docs/examples/locale/get-countries.md b/app/sdks/client-swift/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..df52194af1 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/locale/get-countries.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var locale: Locale = Locale(client: client); + +var result = locale.getCountries(); diff --git a/app/sdks/client-swift/docs/examples/locale/get-currencies.md b/app/sdks/client-swift/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..cf5f403eba --- /dev/null +++ b/app/sdks/client-swift/docs/examples/locale/get-currencies.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var locale: Locale = Locale(client: client); + +var result = locale.getCurrencies(); diff --git a/app/sdks/client-swift/docs/examples/locale/get-languages.md b/app/sdks/client-swift/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..e8296dd7ca --- /dev/null +++ b/app/sdks/client-swift/docs/examples/locale/get-languages.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var locale: Locale = Locale(client: client); + +var result = locale.getLanguages(); diff --git a/app/sdks/client-swift/docs/examples/locale/get.md b/app/sdks/client-swift/docs/examples/locale/get.md new file mode 100644 index 0000000000..5685e89440 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/locale/get.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var locale: Locale = Locale(client: client); + +var result = locale.get(); diff --git a/app/sdks/client-swift/docs/examples/storage/create-file.md b/app/sdks/client-swift/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..b4e15a4ec1 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/storage/create-file.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var storage: Storage = Storage(client: client); + +var result = storage.createFile(_file: nil, _read: [], _write: []); diff --git a/app/sdks/client-swift/docs/examples/storage/delete-file.md b/app/sdks/client-swift/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..83152d9194 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/storage/delete-file.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var storage: Storage = Storage(client: client); + +var result = storage.deleteFile(_fileId: "[FILE_ID]"); diff --git a/app/sdks/client-swift/docs/examples/storage/get-file-download.md b/app/sdks/client-swift/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..023f1a2243 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/storage/get-file-download.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var storage: Storage = Storage(client: client); + +var result = storage.getFileDownload(_fileId: "[FILE_ID]"); diff --git a/app/sdks/client-swift/docs/examples/storage/get-file-preview.md b/app/sdks/client-swift/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..faaacd8e8c --- /dev/null +++ b/app/sdks/client-swift/docs/examples/storage/get-file-preview.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var storage: Storage = Storage(client: client); + +var result = storage.getFilePreview(_fileId: "[FILE_ID]"); diff --git a/app/sdks/client-swift/docs/examples/storage/get-file-view.md b/app/sdks/client-swift/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..d480377b06 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/storage/get-file-view.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var storage: Storage = Storage(client: client); + +var result = storage.getFileView(_fileId: "[FILE_ID]"); diff --git a/app/sdks/client-swift/docs/examples/storage/get-file.md b/app/sdks/client-swift/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..15bf5f7241 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/storage/get-file.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var storage: Storage = Storage(client: client); + +var result = storage.getFile(_fileId: "[FILE_ID]"); diff --git a/app/sdks/client-swift/docs/examples/storage/list-files.md b/app/sdks/client-swift/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..bfce4293e5 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/storage/list-files.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var storage: Storage = Storage(client: client); + +var result = storage.listFiles(); diff --git a/app/sdks/client-swift/docs/examples/storage/update-file.md b/app/sdks/client-swift/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..6a14e47773 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/storage/update-file.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var storage: Storage = Storage(client: client); + +var result = storage.updateFile(_fileId: "[FILE_ID]", _read: [], _write: []); diff --git a/app/sdks/client-swift/docs/examples/teams/create-membership.md b/app/sdks/client-swift/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..4af13ae6ee --- /dev/null +++ b/app/sdks/client-swift/docs/examples/teams/create-membership.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var teams: Teams = Teams(client: client); + +var result = teams.createMembership(_teamId: "[TEAM_ID]", _email: "email@example.com", _roles: [], _url: "https://example.com"); diff --git a/app/sdks/client-swift/docs/examples/teams/create.md b/app/sdks/client-swift/docs/examples/teams/create.md new file mode 100644 index 0000000000..a5cf829019 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/teams/create.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var teams: Teams = Teams(client: client); + +var result = teams.create(_name: "[NAME]"); diff --git a/app/sdks/client-swift/docs/examples/teams/delete-membership.md b/app/sdks/client-swift/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..19bf8b2f7d --- /dev/null +++ b/app/sdks/client-swift/docs/examples/teams/delete-membership.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var teams: Teams = Teams(client: client); + +var result = teams.deleteMembership(_teamId: "[TEAM_ID]", _inviteId: "[INVITE_ID]"); diff --git a/app/sdks/client-swift/docs/examples/teams/delete.md b/app/sdks/client-swift/docs/examples/teams/delete.md new file mode 100644 index 0000000000..50cc25892b --- /dev/null +++ b/app/sdks/client-swift/docs/examples/teams/delete.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var teams: Teams = Teams(client: client); + +var result = teams.delete(_teamId: "[TEAM_ID]"); diff --git a/app/sdks/client-swift/docs/examples/teams/get-memberships.md b/app/sdks/client-swift/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..089ea8f717 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/teams/get-memberships.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var teams: Teams = Teams(client: client); + +var result = teams.getMemberships(_teamId: "[TEAM_ID]"); diff --git a/app/sdks/client-swift/docs/examples/teams/get.md b/app/sdks/client-swift/docs/examples/teams/get.md new file mode 100644 index 0000000000..25bf212a45 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/teams/get.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var teams: Teams = Teams(client: client); + +var result = teams.get(_teamId: "[TEAM_ID]"); diff --git a/app/sdks/client-swift/docs/examples/teams/list.md b/app/sdks/client-swift/docs/examples/teams/list.md new file mode 100644 index 0000000000..8333d1fe43 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/teams/list.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var teams: Teams = Teams(client: client); + +var result = teams.list(); diff --git a/app/sdks/client-swift/docs/examples/teams/update-membership-status.md b/app/sdks/client-swift/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..ae72e4c799 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/teams/update-membership-status.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var teams: Teams = Teams(client: client); + +var result = teams.updateMembershipStatus(_teamId: "[TEAM_ID]", _inviteId: "[INVITE_ID]", _userId: "[USER_ID]", _secret: "[SECRET]"); diff --git a/app/sdks/client-swift/docs/examples/teams/update.md b/app/sdks/client-swift/docs/examples/teams/update.md new file mode 100644 index 0000000000..fafd98b881 --- /dev/null +++ b/app/sdks/client-swift/docs/examples/teams/update.md @@ -0,0 +1,14 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + + +var client: Client = Client() + +client + .setEndpoint(endpoint: "https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setProject(value: "5df5acd0d48c2") // Your project ID + +var teams: Teams = Teams(client: client); + +var result = teams.update(_teamId: "[TEAM_ID]", _name: "[NAME]"); diff --git a/app/sdks/client-swift/docs/locale.md b/app/sdks/client-swift/docs/locale.md new file mode 100644 index 0000000000..efe5a690e2 --- /dev/null +++ b/app/sdks/client-swift/docs/locale.md @@ -0,0 +1,64 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + +# Locale Service + +## Get User Locale + +```http request +GET https://appwrite.io/v1/locale +``` + +** Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. + +([IP Geolocation by DB-IP](https://db-ip.com)) ** + +## List Continents + +```http request +GET https://appwrite.io/v1/locale/continents +``` + +** List of all continents. You can use the locale header to get the data in a supported language. ** + +## List Countries + +```http request +GET https://appwrite.io/v1/locale/countries +``` + +** List of all countries. You can use the locale header to get the data in a supported language. ** + +## List EU Countries + +```http request +GET https://appwrite.io/v1/locale/countries/eu +``` + +** List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. ** + +## List Countries Phone Codes + +```http request +GET https://appwrite.io/v1/locale/countries/phones +``` + +** List of all countries phone codes. You can use the locale header to get the data in a supported language. ** + +## List Currencies + +```http request +GET https://appwrite.io/v1/locale/currencies +``` + +** List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. ** + +## List Languages + +```http request +GET https://appwrite.io/v1/locale/languages +``` + +** List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. ** + diff --git a/app/sdks/client-swift/docs/storage.md b/app/sdks/client-swift/docs/storage.md new file mode 100644 index 0000000000..f902ebd2e9 --- /dev/null +++ b/app/sdks/client-swift/docs/storage.md @@ -0,0 +1,131 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + +# Storage Service + +## List Files + +```http request +GET https://appwrite.io/v1/storage/files +``` + +** Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project files. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create File + +```http request +POST https://appwrite.io/v1/storage/files +``` + +** Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| file | file | Binary file. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Get File + +```http request +GET https://appwrite.io/v1/storage/files/{fileId} +``` + +** Get file by its unique ID. This endpoint response returns a JSON object with the file metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | + +## Update File + +```http request +PUT https://appwrite.io/v1/storage/files/{fileId} +``` + +** Update file by its unique ID. Only users with write permissions have access to update this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Delete File + +```http request +DELETE https://appwrite.io/v1/storage/files/{fileId} +``` + +** Delete a file by its unique ID. Only users with write permissions have access to delete this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | + +## Get File for Download + +```http request +GET https://appwrite.io/v1/storage/files/{fileId}/download +``` + +** Get file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | + +## Get File Preview + +```http request +GET https://appwrite.io/v1/storage/files/{fileId}/preview +``` + +** Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID | | +| width | integer | Resize preview image width, Pass an integer between 0 to 4000. | 0 | +| height | integer | Resize preview image height, Pass an integer between 0 to 4000. | 0 | +| quality | integer | Preview image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | +| background | string | Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. | | +| output | string | Output format type (jpeg, jpg, png, gif and webp). | | + +## Get File for View + +```http request +GET https://appwrite.io/v1/storage/files/{fileId}/view +``` + +** Get file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | +| as | string | Choose a file format to convert your file to. Currently you can only convert word and pdf files to pdf or txt. This option is currently experimental only, use at your own risk. | | + diff --git a/app/sdks/client-swift/docs/teams.md b/app/sdks/client-swift/docs/teams.md new file mode 100644 index 0000000000..7f8b4238a7 --- /dev/null +++ b/app/sdks/client-swift/docs/teams.md @@ -0,0 +1,153 @@ +/// Swift Appwrite SDK +/// Produced by Appwrite SDK Generator +/// + +# Teams Service + +## List Teams + +```http request +GET https://appwrite.io/v1/teams +``` + +** Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project teams. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Team + +```http request +POST https://appwrite.io/v1/teams +``` + +** Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Team name. | | +| roles | array | Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). | ["owner"] | + +## Get Team + +```http request +GET https://appwrite.io/v1/teams/{teamId} +``` + +** Get team by its unique ID. All team members have read access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | + +## Update Team + +```http request +PUT https://appwrite.io/v1/teams/{teamId} +``` + +** Update team by its unique ID. Only team owners have write access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| name | string | Team name. | | + +## Delete Team + +```http request +DELETE https://appwrite.io/v1/teams/{teamId} +``` + +** Delete team by its unique ID. Only team owners have write access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | + +## Get Team Memberships + +```http request +GET https://appwrite.io/v1/teams/{teamId}/memberships +``` + +** Get team members by the team unique ID. All team members have read access for this list of resources. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| search | string | Search term to filter your list results. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Team Membership + +```http request +POST https://appwrite.io/v1/teams/{teamId}/memberships +``` + +** Use this endpoint to invite a new member to join your team. An email with a link to join the team will be sent to the new member email address if the member doesn't exist in the project it will be created automatically. + +Use the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + +Please note that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| email | string | New team member email. | | +| name | string | New team member name. | | +| roles | array | Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions). | | +| url | string | URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | + +## Delete Team Membership + +```http request +DELETE https://appwrite.io/v1/teams/{teamId}/memberships/{inviteId} +``` + +** This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if he didn't accept it. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| inviteId | string | **Required** Invite unique ID. | | + +## Update Team Membership Status + +```http request +PATCH https://appwrite.io/v1/teams/{teamId}/memberships/{inviteId}/status +``` + +** Use this endpoint to allow a user to accept an invitation to join a team after he is being redirected back to your app from the invitation email he was sent. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| inviteId | string | **Required** Invite unique ID. | | +| userId | string | User unique ID. | | +| secret | string | Secret key. | | + diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index b70dbc7be3..a782082430 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -1,6 +1,10 @@ run(); \ No newline at end of file diff --git a/composer.lock b/composer.lock index fe22b1171e..341732c071 100644 --- a/composer.lock +++ b/composer.lock @@ -1952,7 +1952,7 @@ "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "95e29472f8416eb8ce6a83f6b5af9c139ec73ea2" + "reference": "506b82a20a004724d88c3c95a090de30a2479a93" }, "require": { "ext-curl": "*", @@ -1982,7 +1982,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2020-08-17T18:12:07+00:00" + "time": "2020-08-30T05:15:19+00:00" }, { "name": "doctrine/instantiator", @@ -2169,12 +2169,12 @@ "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + "reference": "a3409d10079990eeb489c3fead0ac070b5b38895" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/a3409d10079990eeb489c3fead0ac070b5b38895", + "reference": "a3409d10079990eeb489c3fead0ac070b5b38895", "shasum": "" }, "require": { @@ -2215,7 +2215,7 @@ "type": "tidelift" } ], - "time": "2020-06-29T13:22:24+00:00" + "time": "2020-08-28T16:31:07+00:00" }, { "name": "phar-io/manifest", From b3930ff37a0a60a091a813d192f35d3ab98b3a19 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 3 Sep 2020 13:40:38 +0300 Subject: [PATCH 17/51] Updated flutter-dev channel --- app/config/platforms.php | 2 +- app/sdks/client-flutter-dev/CHANGELOG.md | 5 + app/sdks/client-flutter-dev/README.md | 2 +- app/sdks/client-flutter-dev/lib/client.dart | 44 +++-- .../lib/services/avatars.dart | 24 +++ .../lib/services/storage.dart | 12 ++ app/sdks/client-flutter-dev/pubspec.yaml | 31 +--- composer.lock | 173 +++++++++++++----- docs/sdks/flutter-dev/CHANGELOG.md | 5 + docs/sdks/flutter/CHANGELOG.md | 5 + 10 files changed, 212 insertions(+), 91 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index e3bda605e5..269b9e754c 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -45,7 +45,7 @@ return [ [ 'key' => 'flutter-dev', 'name' => 'Flutter (Dev Channel)', - 'version' => '0.2.3', + 'version' => '0.3.0', 'url' => 'https://github.com/appwrite/sdk-for-flutter-dev', 'enabled' => true, 'beta' => true, diff --git a/app/sdks/client-flutter-dev/CHANGELOG.md b/app/sdks/client-flutter-dev/CHANGELOG.md index c9013a17eb..df959d1994 100644 --- a/app/sdks/client-flutter-dev/CHANGELOG.md +++ b/app/sdks/client-flutter-dev/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.3.0 + +- Updated package dependencies (@lohanidamodar) +- Added Flutter for Web compatibility (@lohanidamodar) + ## 0.2.3 - Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie diff --git a/app/sdks/client-flutter-dev/README.md b/app/sdks/client-flutter-dev/README.md index 09deaf5054..50cfb8336e 100644 --- a/app/sdks/client-flutter-dev/README.md +++ b/app/sdks/client-flutter-dev/README.md @@ -20,7 +20,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^0.2.3 + appwrite: ^0.3.0 ``` You can install packages from the command line: diff --git a/app/sdks/client-flutter-dev/lib/client.dart b/app/sdks/client-flutter-dev/lib/client.dart index 7a53d0414b..29d9884cfe 100644 --- a/app/sdks/client-flutter-dev/lib/client.dart +++ b/app/sdks/client-flutter-dev/lib/client.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; +import 'package:flutter/foundation.dart'; import 'package:dio/adapter.dart'; import 'package:dio_cookie_manager/dio_cookie_manager.dart'; import 'package:cookie_jar/cookie_jar.dart'; @@ -20,17 +21,21 @@ class Client { PersistCookieJar cookieJar; Client({this.endPoint = 'https://appwrite.io/v1', this.selfSigned = false, Dio http}) : this.http = http ?? Dio() { - - type = (Platform.isIOS) ? 'ios' : type; - type = (Platform.isMacOS) ? 'macos' : type; - type = (Platform.isAndroid) ? 'android' : type; - type = (Platform.isLinux) ? 'linux' : type; - type = (Platform.isWindows) ? 'windows' : type; - type = (Platform.isFuchsia) ? 'fuchsia' : type; + // Platform is not supported in web so if web, set type to web automatically and skip Platform check + if(kIsWeb) { + type = 'web'; + }else{ + type = (Platform.isIOS) ? 'ios' : type; + type = (Platform.isMacOS) ? 'macos' : type; + type = (Platform.isAndroid) ? 'android' : type; + type = (Platform.isLinux) ? 'linux' : type; + type = (Platform.isWindows) ? 'windows' : type; + type = (Platform.isFuchsia) ? 'fuchsia' : type; + } this.headers = { 'content-type': 'application/json', - 'x-sdk-version': 'appwrite:dart:0.2.3', + 'x-sdk-version': 'appwrite:flutter:0.3.0', }; this.config = {}; @@ -78,17 +83,20 @@ class Client { Future init() async { if(!initialized) { - final Directory cookieDir = await _getCookiePath(); - - cookieJar = new PersistCookieJar(dir:cookieDir.path); + // if web skip cookie implementation and origin header as those are automatically handled by browsers + if(!kIsWeb) { + final Directory cookieDir = await _getCookiePath(); + cookieJar = new PersistCookieJar(dir:cookieDir.path); + this.http.interceptors.add(CookieManager(cookieJar)); + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName); + }else{ + // if web set httpClientAdapter as BrowserHttpClientAdapter with withCredentials true to make cookies work + this.http.options.extra['withCredentials'] = true; + } this.http.options.baseUrl = this.endPoint; this.http.options.validateStatus = (status) => status < 400; - this.http.interceptors.add(CookieManager(cookieJar)); - - PackageInfo packageInfo = await PackageInfo.fromPlatform(); - - addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName); } } @@ -114,6 +122,10 @@ class Client { } if (method == HttpMethod.get) { + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + return http.get(path, queryParameters: params, options: options); } else { return http.request(path, data: params, options: options); diff --git a/app/sdks/client-flutter-dev/lib/services/avatars.dart b/app/sdks/client-flutter-dev/lib/services/avatars.dart index fc9c403d90..828ea7dfb0 100644 --- a/app/sdks/client-flutter-dev/lib/services/avatars.dart +++ b/app/sdks/client-flutter-dev/lib/services/avatars.dart @@ -27,6 +27,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -55,6 +59,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -79,6 +87,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -106,6 +118,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -134,6 +150,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -161,6 +181,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, diff --git a/app/sdks/client-flutter-dev/lib/services/storage.dart b/app/sdks/client-flutter-dev/lib/services/storage.dart index 696c15ee3a..51f9345050 100644 --- a/app/sdks/client-flutter-dev/lib/services/storage.dart +++ b/app/sdks/client-flutter-dev/lib/services/storage.dart @@ -124,6 +124,10 @@ class Storage extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -154,6 +158,10 @@ class Storage extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -178,6 +186,10 @@ class Storage extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, diff --git a/app/sdks/client-flutter-dev/pubspec.yaml b/app/sdks/client-flutter-dev/pubspec.yaml index ea8f29d01e..5dc7fc8457 100644 --- a/app/sdks/client-flutter-dev/pubspec.yaml +++ b/app/sdks/client-flutter-dev/pubspec.yaml @@ -1,5 +1,5 @@ -name: appwrite -version: 0.2.3 +name: appwrite-dev +version: 0.3.0 description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-flutter-dev @@ -8,31 +8,16 @@ documentation: https://appwrite.io/support environment: sdk: '>=2.6.0 <3.0.0' dependencies: - meta: ^1.1.8 - path_provider: ^1.6.5 - package_info: ^0.4.0+16 - dio: ^3.0.0 - cookie_jar: ^1.0.0 + meta: ^1.2.2 + path_provider: ^1.6.14 + package_info: ^0.4.3 + dio: ^3.0.10 + cookie_jar: ^1.0.1 dio_cookie_manager: ^1.0.0 flutter_web_auth: ^0.2.4 flutter: sdk: flutter - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 - dev_dependencies: flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. -flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. - uses-material-design: true \ No newline at end of file + sdk: flutter \ No newline at end of file diff --git a/composer.lock b/composer.lock index d4d95b4b55..edadc2bd5e 100644 --- a/composer.lock +++ b/composer.lock @@ -239,12 +239,12 @@ "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd" + "reference": "8a7ecad675253e4654ea05505233285377405215" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/95c63ab2117a72f48f5a55da9740a3273d45b7fd", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8a7ecad675253e4654ea05505233285377405215", + "reference": "8a7ecad675253e4654ea05505233285377405215", "shasum": "" }, "require": { @@ -287,25 +287,39 @@ "ssl", "tls" ], - "time": "2020-04-08T08:27:21+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-08-23T12:54:47+00:00" }, { "name": "dasprid/enum", - "version": "1.0.0", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/DASPRiD/Enum.git", - "reference": "631ef6e638e9494b0310837fa531bedd908fc22b" + "reference": "6ccc0d7141a7f149e3c56cb0ce5f05d9152cfd07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/631ef6e638e9494b0310837fa531bedd908fc22b", - "reference": "631ef6e638e9494b0310837fa531bedd908fc22b", + "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/6ccc0d7141a7f149e3c56cb0ce5f05d9152cfd07", + "reference": "6ccc0d7141a7f149e3c56cb0ce5f05d9152cfd07", "shasum": "" }, "require-dev": { - "phpunit/phpunit": "^6.4", - "squizlabs/php_codesniffer": "^3.1" + "phpunit/phpunit": "^7 | ^8 | ^9", + "squizlabs/php_codesniffer": "^3.4" }, "type": "library", "autoload": { @@ -321,7 +335,8 @@ { "name": "Ben Scholzen 'DASPRiD'", "email": "mail@dasprids.de", - "homepage": "https://dasprids.de/" + "homepage": "https://dasprids.de/", + "role": "Developer" } ], "description": "PHP 7.1 enum implementation", @@ -329,7 +344,7 @@ "enum", "map" ], - "time": "2017-10-25T22:45:27+00:00" + "time": "2020-07-30T16:37:13+00:00" }, { "name": "domnikl/statsd", @@ -544,6 +559,28 @@ "rest", "web service" ], + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://github.com/alexeyshockov", + "type": "github" + }, + { + "url": "https://github.com/gmponos", + "type": "github" + }, + { + "url": "https://github.com/sagikazarmark", + "type": "github" + } + ], "time": "2020-07-02T06:52:04+00:00" }, { @@ -731,29 +768,29 @@ }, { "name": "maxmind-db/reader", - "version": "v1.6.0", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git", - "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4" + "reference": "942553da239f12051275f9c666538b5dd09e2908" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/febd4920bf17c1da84cef58e56a8227dfb37fbe4", - "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4", + "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/942553da239f12051275f9c666538b5dd09e2908", + "reference": "942553da239f12051275f9c666538b5dd09e2908", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.2" }, "conflict": { - "ext-maxminddb": "<1.6.0,>=2.0.0" + "ext-maxminddb": "<1.7.0,>=2.0.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "2.*", "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpcov": "^3.0", - "phpunit/phpunit": "5.*", + "phpunit/phpcov": ">=6.0.0", + "phpunit/phpunit": ">=8.0.0,<10.0.0", "squizlabs/php_codesniffer": "3.*" }, "suggest": { @@ -787,7 +824,7 @@ "geolocation", "maxmind" ], - "time": "2019-12-19T22:59:03+00:00" + "time": "2020-08-07T22:10:05+00:00" }, { "name": "maxmind/web-service-common", @@ -987,6 +1024,12 @@ } ], "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "funding": [ + { + "url": "https://github.com/synchro", + "type": "github" + } + ], "time": "2020-05-27T12:24:03+00:00" }, { @@ -1183,12 +1226,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe" + "reference": "045643b91eaa34c4c37150ac477765c13552af33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/bc6549d068d0160e0f10f7a5a23c7d1406b95ebe", - "reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/045643b91eaa34c4c37150ac477765c13552af33", + "reference": "045643b91eaa34c4c37150ac477765c13552af33", "shasum": "" }, "require": { @@ -1260,7 +1303,7 @@ "type": "tidelift" } ], - "time": "2020-07-14T12:35:20+00:00" + "time": "2020-08-04T21:02:56+00:00" }, { "name": "symfony/polyfill-intl-normalizer", @@ -1923,7 +1966,7 @@ "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "404cf6bb4c75f8ae3b2419e04f6afd215ed706a5" + "reference": "0dea55e58e3ec59dd3557a4144fcbb390691e03a" }, "require": { "ext-curl": "*", @@ -1953,7 +1996,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2020-07-26T07:11:06+00:00" + "time": "2020-09-03T10:16:09+00:00" }, { "name": "doctrine/instantiator", @@ -2009,6 +2052,20 @@ "constructor", "instantiate" ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], "time": "2020-06-15T18:51:04+00:00" }, { @@ -2126,12 +2183,12 @@ "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + "reference": "a3409d10079990eeb489c3fead0ac070b5b38895" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/a3409d10079990eeb489c3fead0ac070b5b38895", + "reference": "a3409d10079990eeb489c3fead0ac070b5b38895", "shasum": "" }, "require": { @@ -2166,7 +2223,13 @@ "object", "object graph" ], - "time": "2020-06-29T13:22:24+00:00" + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-08-28T16:31:07+00:00" }, { "name": "phar-io/manifest", @@ -2325,12 +2388,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "1ac416df3f66c542f2d3688925105b539f064b64" + "reference": "f6075926e937828b180e02964e2d2062af8a9537" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/1ac416df3f66c542f2d3688925105b539f064b64", - "reference": "1ac416df3f66c542f2d3688925105b539f064b64", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/f6075926e937828b180e02964e2d2062af8a9537", + "reference": "f6075926e937828b180e02964e2d2062af8a9537", "shasum": "" }, "require": { @@ -2369,34 +2432,33 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-07-21T08:16:41+00:00" + "time": "2020-09-02T21:38:01+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "dev-master", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "94f3ddc5d77e49daadadd33b798b933e52dde82c" + "reference": "e21c0bd532911ec05ebc258e4086ea61c86e0750" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/94f3ddc5d77e49daadadd33b798b933e52dde82c", - "reference": "94f3ddc5d77e49daadadd33b798b933e52dde82c", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e21c0bd532911ec05ebc258e4086ea61c86e0750", + "reference": "e21c0bd532911ec05ebc258e4086ea61c86e0750", "shasum": "" }, "require": { - "php": "^7.2", + "php": "^7.2 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "^7.2", - "mockery/mockery": "~1" + "ext-tokenizer": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { @@ -2415,7 +2477,7 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-19T19:40:27+00:00" + "time": "2020-09-02T21:29:45+00:00" }, { "name": "phpspec/prophecy", @@ -2685,7 +2747,7 @@ }, { "name": "phpunit/php-token-stream", - "version": "3.1.1", + "version": "3.1.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", @@ -2730,6 +2792,7 @@ "keywords": [ "tokenizer" ], + "abandoned": true, "time": "2019-09-17T06:23:10+00:00" }, { @@ -3587,12 +3650,12 @@ "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "e063bab1a67f4ceea759cee20c10ed609d1f6abb" + "reference": "b48bd18dc6f967ad09af9eab521cdf0e68fb6a95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/e063bab1a67f4ceea759cee20c10ed609d1f6abb", - "reference": "e063bab1a67f4ceea759cee20c10ed609d1f6abb", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/b48bd18dc6f967ad09af9eab521cdf0e68fb6a95", + "reference": "b48bd18dc6f967ad09af9eab521cdf0e68fb6a95", "shasum": "" }, "require": { @@ -3607,7 +3670,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.13-dev" + "dev-master": "2.14-dev" } }, "autoload": { @@ -3644,7 +3707,17 @@ "keywords": [ "templating" ], - "time": "2020-07-06T13:35:12+00:00" + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2020-08-23T15:56:05+00:00" }, { "name": "webmozart/assert", diff --git a/docs/sdks/flutter-dev/CHANGELOG.md b/docs/sdks/flutter-dev/CHANGELOG.md index 36f7668043..945f6088ae 100644 --- a/docs/sdks/flutter-dev/CHANGELOG.md +++ b/docs/sdks/flutter-dev/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.3.0 + +- Updated package dependencies (@lohanidamodar) +- Added Flutter for Web compatibility (@lohanidamodar) + ## 0.2.3 - Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie diff --git a/docs/sdks/flutter/CHANGELOG.md b/docs/sdks/flutter/CHANGELOG.md index 36f7668043..945f6088ae 100644 --- a/docs/sdks/flutter/CHANGELOG.md +++ b/docs/sdks/flutter/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.3.0 + +- Updated package dependencies (@lohanidamodar) +- Added Flutter for Web compatibility (@lohanidamodar) + ## 0.2.3 - Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie From b70d55735994c98341bf09e8334c05e25863a277 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 3 Sep 2020 13:54:19 +0300 Subject: [PATCH 18/51] Updated flutter dev package name --- app/tasks/sdks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index 7e5f7485fb..932467bd37 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -121,7 +121,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND break; case 'flutter-dev': $config = new Flutter(); - $config->setPackageName('appwrite-dev'); + $config->setPackageName('appwrite_dev'); break; case 'dart': $config = new Dart(); From d82697fa8c0dc32b2d489f95680711ef86e6f4d0 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 3 Sep 2020 13:56:06 +0300 Subject: [PATCH 19/51] Updqted flutter dev package name --- app/sdks/client-flutter-dev/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/sdks/client-flutter-dev/pubspec.yaml b/app/sdks/client-flutter-dev/pubspec.yaml index 5dc7fc8457..d1fbd6f542 100644 --- a/app/sdks/client-flutter-dev/pubspec.yaml +++ b/app/sdks/client-flutter-dev/pubspec.yaml @@ -1,4 +1,4 @@ -name: appwrite-dev +name: appwrite_dev version: 0.3.0 description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io From be3d445cb666f9bc317e4d1ff4234fd229701561 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 3 Sep 2020 14:09:22 +0300 Subject: [PATCH 20/51] Update package name --- app/sdks/client-flutter-dev/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/sdks/client-flutter-dev/README.md b/app/sdks/client-flutter-dev/README.md index 50cfb8336e..90d55f00e9 100644 --- a/app/sdks/client-flutter-dev/README.md +++ b/app/sdks/client-flutter-dev/README.md @@ -20,13 +20,13 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^0.3.0 + appwrite_dev: ^0.3.0 ``` You can install packages from the command line: ```bash -pub get appwrite +pub get appwrite_dev ``` ## Contribution From 4a6b860e7ed134de8ce4466712a5916b8a803d17 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 3 Sep 2020 16:26:05 +0300 Subject: [PATCH 21/51] Fixed package namespaces --- app/config/platforms.php | 2 +- app/sdks/client-flutter-dev/CHANGELOG.md | 8 ++++++++ app/sdks/client-flutter-dev/README.md | 2 +- .../docs/examples/account/create-o-auth2session.md | 2 +- .../docs/examples/account/create-recovery.md | 2 +- .../docs/examples/account/create-session.md | 2 +- .../docs/examples/account/create-verification.md | 2 +- .../client-flutter-dev/docs/examples/account/create.md | 2 +- .../docs/examples/account/delete-session.md | 2 +- .../docs/examples/account/delete-sessions.md | 2 +- .../client-flutter-dev/docs/examples/account/delete.md | 2 +- .../docs/examples/account/get-logs.md | 2 +- .../docs/examples/account/get-prefs.md | 2 +- .../docs/examples/account/get-sessions.md | 2 +- .../client-flutter-dev/docs/examples/account/get.md | 2 +- .../docs/examples/account/update-email.md | 2 +- .../docs/examples/account/update-name.md | 2 +- .../docs/examples/account/update-password.md | 2 +- .../docs/examples/account/update-prefs.md | 2 +- .../docs/examples/account/update-recovery.md | 2 +- .../docs/examples/account/update-verification.md | 2 +- .../docs/examples/avatars/get-browser.md | 2 +- .../docs/examples/avatars/get-credit-card.md | 2 +- .../docs/examples/avatars/get-favicon.md | 2 +- .../docs/examples/avatars/get-flag.md | 2 +- .../docs/examples/avatars/get-image.md | 2 +- .../docs/examples/avatars/get-q-r.md | 2 +- .../docs/examples/database/create-document.md | 2 +- .../docs/examples/database/delete-document.md | 2 +- .../docs/examples/database/get-document.md | 2 +- .../docs/examples/database/list-documents.md | 2 +- .../docs/examples/database/update-document.md | 2 +- .../docs/examples/locale/get-continents.md | 2 +- .../docs/examples/locale/get-countries-e-u.md | 2 +- .../docs/examples/locale/get-countries-phones.md | 2 +- .../docs/examples/locale/get-countries.md | 2 +- .../docs/examples/locale/get-currencies.md | 2 +- .../client-flutter-dev/docs/examples/locale/get.md | 2 +- .../docs/examples/storage/create-file.md | 2 +- .../docs/examples/storage/delete-file.md | 2 +- .../docs/examples/storage/get-file-download.md | 2 +- .../docs/examples/storage/get-file-preview.md | 2 +- .../docs/examples/storage/get-file-view.md | 2 +- .../docs/examples/storage/get-file.md | 2 +- .../docs/examples/storage/list-files.md | 2 +- .../docs/examples/storage/update-file.md | 2 +- .../docs/examples/teams/create-membership.md | 2 +- .../client-flutter-dev/docs/examples/teams/create.md | 2 +- .../docs/examples/teams/delete-membership.md | 2 +- .../client-flutter-dev/docs/examples/teams/delete.md | 2 +- .../docs/examples/teams/get-memberships.md | 2 +- app/sdks/client-flutter-dev/docs/examples/teams/get.md | 2 +- .../client-flutter-dev/docs/examples/teams/list.md | 2 +- .../docs/examples/teams/update-membership-status.md | 2 +- .../client-flutter-dev/docs/examples/teams/update.md | 2 +- app/sdks/client-flutter-dev/lib/appwrite_dev.dart | 10 ++++++++++ app/sdks/client-flutter-dev/lib/client.dart | 2 +- app/sdks/client-flutter-dev/pubspec.yaml | 4 ++-- composer.lock | 4 ++-- docs/sdks/flutter-dev/CHANGELOG.md | 8 ++++++++ 60 files changed, 85 insertions(+), 59 deletions(-) create mode 100644 app/sdks/client-flutter-dev/lib/appwrite_dev.dart diff --git a/app/config/platforms.php b/app/config/platforms.php index 269b9e754c..aac1180795 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -45,7 +45,7 @@ return [ [ 'key' => 'flutter-dev', 'name' => 'Flutter (Dev Channel)', - 'version' => '0.3.0', + 'version' => '0.3.2', 'url' => 'https://github.com/appwrite/sdk-for-flutter-dev', 'enabled' => true, 'beta' => true, diff --git a/app/sdks/client-flutter-dev/CHANGELOG.md b/app/sdks/client-flutter-dev/CHANGELOG.md index df959d1994..2e9b0e0a91 100644 --- a/app/sdks/client-flutter-dev/CHANGELOG.md +++ b/app/sdks/client-flutter-dev/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.3.2 + +- Fixed package namespaces + +## 0.3.1 + +- Downgraded meta package version to 1.1.8 + ## 0.3.0 - Updated package dependencies (@lohanidamodar) diff --git a/app/sdks/client-flutter-dev/README.md b/app/sdks/client-flutter-dev/README.md index 90d55f00e9..2c0ba754c3 100644 --- a/app/sdks/client-flutter-dev/README.md +++ b/app/sdks/client-flutter-dev/README.md @@ -20,7 +20,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite_dev: ^0.3.0 + appwrite_dev: ^0.3.2 ``` You can install packages from the command line: diff --git a/app/sdks/client-flutter-dev/docs/examples/account/create-o-auth2session.md b/app/sdks/client-flutter-dev/docs/examples/account/create-o-auth2session.md index c617c34d4d..aae9d5f9a0 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/create-o-auth2session.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/create-o-auth2session.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/create-recovery.md b/app/sdks/client-flutter-dev/docs/examples/account/create-recovery.md index 50db45b15d..32fe469cff 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/create-recovery.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/create-recovery.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/create-session.md b/app/sdks/client-flutter-dev/docs/examples/account/create-session.md index ef824b4eca..a5930877f4 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/create-session.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/create-session.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/create-verification.md b/app/sdks/client-flutter-dev/docs/examples/account/create-verification.md index 6b9b1ace40..738f22df42 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/create-verification.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/create-verification.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/create.md b/app/sdks/client-flutter-dev/docs/examples/account/create.md index 384258ae68..1f92976c39 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/create.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/create.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/delete-session.md b/app/sdks/client-flutter-dev/docs/examples/account/delete-session.md index 80a3f505d0..95b3641387 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/delete-session.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/delete-session.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/delete-sessions.md b/app/sdks/client-flutter-dev/docs/examples/account/delete-sessions.md index 5e947fabc2..b9cbb46fd2 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/delete-sessions.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/delete-sessions.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/delete.md b/app/sdks/client-flutter-dev/docs/examples/account/delete.md index 2853a1f437..8c99b2ac61 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/delete.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/delete.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/get-logs.md b/app/sdks/client-flutter-dev/docs/examples/account/get-logs.md index 8f52f8220b..2ed66d88ce 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/get-logs.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/get-logs.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/get-prefs.md b/app/sdks/client-flutter-dev/docs/examples/account/get-prefs.md index 01d57a5499..961a24dc19 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/get-prefs.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/get-prefs.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/get-sessions.md b/app/sdks/client-flutter-dev/docs/examples/account/get-sessions.md index e921bda59b..76a566b959 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/get-sessions.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/get-sessions.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/get.md b/app/sdks/client-flutter-dev/docs/examples/account/get.md index 35241b5607..cd05062a69 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/get.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/get.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/update-email.md b/app/sdks/client-flutter-dev/docs/examples/account/update-email.md index 4a1a002db4..9fc86a7aae 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/update-email.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/update-email.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/update-name.md b/app/sdks/client-flutter-dev/docs/examples/account/update-name.md index fa432bb34a..e5e218a515 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/update-name.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/update-name.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/update-password.md b/app/sdks/client-flutter-dev/docs/examples/account/update-password.md index 9bd8ad9b77..869b4d9a30 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/update-password.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/update-password.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/update-prefs.md b/app/sdks/client-flutter-dev/docs/examples/account/update-prefs.md index 443252f89a..0d50469742 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/update-prefs.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/update-prefs.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/update-recovery.md b/app/sdks/client-flutter-dev/docs/examples/account/update-recovery.md index 5140235d49..e028e60a7d 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/update-recovery.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/update-recovery.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/account/update-verification.md b/app/sdks/client-flutter-dev/docs/examples/account/update-verification.md index b795cde92d..48d669efcc 100644 --- a/app/sdks/client-flutter-dev/docs/examples/account/update-verification.md +++ b/app/sdks/client-flutter-dev/docs/examples/account/update-verification.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/avatars/get-browser.md b/app/sdks/client-flutter-dev/docs/examples/avatars/get-browser.md index 464767c4c0..dec7863b1f 100644 --- a/app/sdks/client-flutter-dev/docs/examples/avatars/get-browser.md +++ b/app/sdks/client-flutter-dev/docs/examples/avatars/get-browser.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/avatars/get-credit-card.md b/app/sdks/client-flutter-dev/docs/examples/avatars/get-credit-card.md index 482c642402..e2746c4999 100644 --- a/app/sdks/client-flutter-dev/docs/examples/avatars/get-credit-card.md +++ b/app/sdks/client-flutter-dev/docs/examples/avatars/get-credit-card.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/avatars/get-favicon.md b/app/sdks/client-flutter-dev/docs/examples/avatars/get-favicon.md index 60397b0af2..1c56335b9f 100644 --- a/app/sdks/client-flutter-dev/docs/examples/avatars/get-favicon.md +++ b/app/sdks/client-flutter-dev/docs/examples/avatars/get-favicon.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/avatars/get-flag.md b/app/sdks/client-flutter-dev/docs/examples/avatars/get-flag.md index a9f7a711d9..8a91f608ce 100644 --- a/app/sdks/client-flutter-dev/docs/examples/avatars/get-flag.md +++ b/app/sdks/client-flutter-dev/docs/examples/avatars/get-flag.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/avatars/get-image.md b/app/sdks/client-flutter-dev/docs/examples/avatars/get-image.md index 7cead1cb2f..a2cbea98e3 100644 --- a/app/sdks/client-flutter-dev/docs/examples/avatars/get-image.md +++ b/app/sdks/client-flutter-dev/docs/examples/avatars/get-image.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/avatars/get-q-r.md b/app/sdks/client-flutter-dev/docs/examples/avatars/get-q-r.md index a5bcfd2c05..2737297082 100644 --- a/app/sdks/client-flutter-dev/docs/examples/avatars/get-q-r.md +++ b/app/sdks/client-flutter-dev/docs/examples/avatars/get-q-r.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/database/create-document.md b/app/sdks/client-flutter-dev/docs/examples/database/create-document.md index b7d540bc2d..6fc27bdfbb 100644 --- a/app/sdks/client-flutter-dev/docs/examples/database/create-document.md +++ b/app/sdks/client-flutter-dev/docs/examples/database/create-document.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/database/delete-document.md b/app/sdks/client-flutter-dev/docs/examples/database/delete-document.md index 40c1cbdfe2..74bcd69d9a 100644 --- a/app/sdks/client-flutter-dev/docs/examples/database/delete-document.md +++ b/app/sdks/client-flutter-dev/docs/examples/database/delete-document.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/database/get-document.md b/app/sdks/client-flutter-dev/docs/examples/database/get-document.md index 0c98142315..639209ed3c 100644 --- a/app/sdks/client-flutter-dev/docs/examples/database/get-document.md +++ b/app/sdks/client-flutter-dev/docs/examples/database/get-document.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/database/list-documents.md b/app/sdks/client-flutter-dev/docs/examples/database/list-documents.md index 0685e7f1aa..41eac5dd9a 100644 --- a/app/sdks/client-flutter-dev/docs/examples/database/list-documents.md +++ b/app/sdks/client-flutter-dev/docs/examples/database/list-documents.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/database/update-document.md b/app/sdks/client-flutter-dev/docs/examples/database/update-document.md index 2f37cd767a..0b153b1595 100644 --- a/app/sdks/client-flutter-dev/docs/examples/database/update-document.md +++ b/app/sdks/client-flutter-dev/docs/examples/database/update-document.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/locale/get-continents.md b/app/sdks/client-flutter-dev/docs/examples/locale/get-continents.md index 2a6a6413ba..2c6bd7389f 100644 --- a/app/sdks/client-flutter-dev/docs/examples/locale/get-continents.md +++ b/app/sdks/client-flutter-dev/docs/examples/locale/get-continents.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/locale/get-countries-e-u.md b/app/sdks/client-flutter-dev/docs/examples/locale/get-countries-e-u.md index 1934fc6709..443fb2d115 100644 --- a/app/sdks/client-flutter-dev/docs/examples/locale/get-countries-e-u.md +++ b/app/sdks/client-flutter-dev/docs/examples/locale/get-countries-e-u.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/locale/get-countries-phones.md b/app/sdks/client-flutter-dev/docs/examples/locale/get-countries-phones.md index f6b1f58749..e08e2bca47 100644 --- a/app/sdks/client-flutter-dev/docs/examples/locale/get-countries-phones.md +++ b/app/sdks/client-flutter-dev/docs/examples/locale/get-countries-phones.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/locale/get-countries.md b/app/sdks/client-flutter-dev/docs/examples/locale/get-countries.md index 104584968f..a64a23c666 100644 --- a/app/sdks/client-flutter-dev/docs/examples/locale/get-countries.md +++ b/app/sdks/client-flutter-dev/docs/examples/locale/get-countries.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/locale/get-currencies.md b/app/sdks/client-flutter-dev/docs/examples/locale/get-currencies.md index 8dc01fc68e..e086245ffd 100644 --- a/app/sdks/client-flutter-dev/docs/examples/locale/get-currencies.md +++ b/app/sdks/client-flutter-dev/docs/examples/locale/get-currencies.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/locale/get.md b/app/sdks/client-flutter-dev/docs/examples/locale/get.md index 189fceb7d1..5cb8ae176e 100644 --- a/app/sdks/client-flutter-dev/docs/examples/locale/get.md +++ b/app/sdks/client-flutter-dev/docs/examples/locale/get.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/storage/create-file.md b/app/sdks/client-flutter-dev/docs/examples/storage/create-file.md index 9f61be12f4..d824bd5831 100644 --- a/app/sdks/client-flutter-dev/docs/examples/storage/create-file.md +++ b/app/sdks/client-flutter-dev/docs/examples/storage/create-file.md @@ -1,5 +1,5 @@ import 'dart:io'; -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/storage/delete-file.md b/app/sdks/client-flutter-dev/docs/examples/storage/delete-file.md index 271ed7b2dd..88e7b8815c 100644 --- a/app/sdks/client-flutter-dev/docs/examples/storage/delete-file.md +++ b/app/sdks/client-flutter-dev/docs/examples/storage/delete-file.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/storage/get-file-download.md b/app/sdks/client-flutter-dev/docs/examples/storage/get-file-download.md index be3385a61b..483340e24a 100644 --- a/app/sdks/client-flutter-dev/docs/examples/storage/get-file-download.md +++ b/app/sdks/client-flutter-dev/docs/examples/storage/get-file-download.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/storage/get-file-preview.md b/app/sdks/client-flutter-dev/docs/examples/storage/get-file-preview.md index 8bd1a47457..dd8d924fe7 100644 --- a/app/sdks/client-flutter-dev/docs/examples/storage/get-file-preview.md +++ b/app/sdks/client-flutter-dev/docs/examples/storage/get-file-preview.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/storage/get-file-view.md b/app/sdks/client-flutter-dev/docs/examples/storage/get-file-view.md index 5803fd409f..8ed6a946e0 100644 --- a/app/sdks/client-flutter-dev/docs/examples/storage/get-file-view.md +++ b/app/sdks/client-flutter-dev/docs/examples/storage/get-file-view.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/storage/get-file.md b/app/sdks/client-flutter-dev/docs/examples/storage/get-file.md index feca667fa9..4e398f88fd 100644 --- a/app/sdks/client-flutter-dev/docs/examples/storage/get-file.md +++ b/app/sdks/client-flutter-dev/docs/examples/storage/get-file.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/storage/list-files.md b/app/sdks/client-flutter-dev/docs/examples/storage/list-files.md index 1963ec694d..d72ba29e03 100644 --- a/app/sdks/client-flutter-dev/docs/examples/storage/list-files.md +++ b/app/sdks/client-flutter-dev/docs/examples/storage/list-files.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/storage/update-file.md b/app/sdks/client-flutter-dev/docs/examples/storage/update-file.md index a5ecbfe987..95e213ddc2 100644 --- a/app/sdks/client-flutter-dev/docs/examples/storage/update-file.md +++ b/app/sdks/client-flutter-dev/docs/examples/storage/update-file.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/teams/create-membership.md b/app/sdks/client-flutter-dev/docs/examples/teams/create-membership.md index e5e82de7b4..31bf7ec1af 100644 --- a/app/sdks/client-flutter-dev/docs/examples/teams/create-membership.md +++ b/app/sdks/client-flutter-dev/docs/examples/teams/create-membership.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/teams/create.md b/app/sdks/client-flutter-dev/docs/examples/teams/create.md index d11958ae6d..e50279de01 100644 --- a/app/sdks/client-flutter-dev/docs/examples/teams/create.md +++ b/app/sdks/client-flutter-dev/docs/examples/teams/create.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/teams/delete-membership.md b/app/sdks/client-flutter-dev/docs/examples/teams/delete-membership.md index 3f57b840fe..015507d3a2 100644 --- a/app/sdks/client-flutter-dev/docs/examples/teams/delete-membership.md +++ b/app/sdks/client-flutter-dev/docs/examples/teams/delete-membership.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/teams/delete.md b/app/sdks/client-flutter-dev/docs/examples/teams/delete.md index 9fb488afec..6cc1367f9b 100644 --- a/app/sdks/client-flutter-dev/docs/examples/teams/delete.md +++ b/app/sdks/client-flutter-dev/docs/examples/teams/delete.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/teams/get-memberships.md b/app/sdks/client-flutter-dev/docs/examples/teams/get-memberships.md index 4edadfa2b4..d427c9ac47 100644 --- a/app/sdks/client-flutter-dev/docs/examples/teams/get-memberships.md +++ b/app/sdks/client-flutter-dev/docs/examples/teams/get-memberships.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/teams/get.md b/app/sdks/client-flutter-dev/docs/examples/teams/get.md index 083565f7a6..1bca70a23f 100644 --- a/app/sdks/client-flutter-dev/docs/examples/teams/get.md +++ b/app/sdks/client-flutter-dev/docs/examples/teams/get.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/teams/list.md b/app/sdks/client-flutter-dev/docs/examples/teams/list.md index 665020e928..c56e7a5dd5 100644 --- a/app/sdks/client-flutter-dev/docs/examples/teams/list.md +++ b/app/sdks/client-flutter-dev/docs/examples/teams/list.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/teams/update-membership-status.md b/app/sdks/client-flutter-dev/docs/examples/teams/update-membership-status.md index 616f64e148..6098b38ed9 100644 --- a/app/sdks/client-flutter-dev/docs/examples/teams/update-membership-status.md +++ b/app/sdks/client-flutter-dev/docs/examples/teams/update-membership-status.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/docs/examples/teams/update.md b/app/sdks/client-flutter-dev/docs/examples/teams/update.md index 915fb57d38..2494f408d9 100644 --- a/app/sdks/client-flutter-dev/docs/examples/teams/update.md +++ b/app/sdks/client-flutter-dev/docs/examples/teams/update.md @@ -1,4 +1,4 @@ -import 'package:appwrite/appwrite.dart'; +import 'package:appwrite_dev/appwrite_dev.dart'; void main() { // Init SDK Client client = Client(); diff --git a/app/sdks/client-flutter-dev/lib/appwrite_dev.dart b/app/sdks/client-flutter-dev/lib/appwrite_dev.dart new file mode 100644 index 0000000000..95d0b72cfe --- /dev/null +++ b/app/sdks/client-flutter-dev/lib/appwrite_dev.dart @@ -0,0 +1,10 @@ +export 'package:dio/dio.dart' show Response; + +export 'client.dart'; +export 'enums.dart'; +export 'services/account.dart'; +export 'services/avatars.dart'; +export 'services/database.dart'; +export 'services/locale.dart'; +export 'services/storage.dart'; +export 'services/teams.dart'; diff --git a/app/sdks/client-flutter-dev/lib/client.dart b/app/sdks/client-flutter-dev/lib/client.dart index 29d9884cfe..a5583fcd00 100644 --- a/app/sdks/client-flutter-dev/lib/client.dart +++ b/app/sdks/client-flutter-dev/lib/client.dart @@ -35,7 +35,7 @@ class Client { this.headers = { 'content-type': 'application/json', - 'x-sdk-version': 'appwrite:flutter:0.3.0', + 'x-sdk-version': 'appwrite:flutter:0.3.2', }; this.config = {}; diff --git a/app/sdks/client-flutter-dev/pubspec.yaml b/app/sdks/client-flutter-dev/pubspec.yaml index d1fbd6f542..7d3646b8ee 100644 --- a/app/sdks/client-flutter-dev/pubspec.yaml +++ b/app/sdks/client-flutter-dev/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite_dev -version: 0.3.0 +version: 0.3.2 description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-flutter-dev @@ -8,7 +8,7 @@ documentation: https://appwrite.io/support environment: sdk: '>=2.6.0 <3.0.0' dependencies: - meta: ^1.2.2 + meta: ^1.1.8 path_provider: ^1.6.14 package_info: ^0.4.3 dio: ^3.0.10 diff --git a/composer.lock b/composer.lock index edadc2bd5e..18a431a412 100644 --- a/composer.lock +++ b/composer.lock @@ -1966,7 +1966,7 @@ "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "0dea55e58e3ec59dd3557a4144fcbb390691e03a" + "reference": "dddbc208ff429298f5c1b2b95fc507aa639c8def" }, "require": { "ext-curl": "*", @@ -1996,7 +1996,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2020-09-03T10:16:09+00:00" + "time": "2020-09-03T13:22:30+00:00" }, { "name": "doctrine/instantiator", diff --git a/docs/sdks/flutter-dev/CHANGELOG.md b/docs/sdks/flutter-dev/CHANGELOG.md index 945f6088ae..ff6f7fa1a7 100644 --- a/docs/sdks/flutter-dev/CHANGELOG.md +++ b/docs/sdks/flutter-dev/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.3.2 + +- Fixed package namespaces + +## 0.3.1 + +- Downgraded meta package version to 1.1.8 + ## 0.3.0 - Updated package dependencies (@lohanidamodar) From ee9c5c92a70092c155cdf4cb906d6cb9fc715a51 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 3 Sep 2020 20:31:31 +0300 Subject: [PATCH 22/51] Updated Flutter SDK --- app/config/platforms.php | 2 +- app/sdks/client-flutter/CHANGELOG.md | 5 +++ app/sdks/client-flutter/README.md | 2 +- app/sdks/client-flutter/lib/client.dart | 44 ++++++++++++------- .../client-flutter/lib/services/avatars.dart | 24 ++++++++++ .../client-flutter/lib/services/storage.dart | 12 +++++ app/sdks/client-flutter/pubspec.yaml | 27 +++--------- docs/sdks/flutter/CHANGELOG.md | 2 +- 8 files changed, 78 insertions(+), 40 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index aac1180795..c3d09fac13 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -30,7 +30,7 @@ return [ [ 'key' => 'flutter', 'name' => 'Flutter', - 'version' => '0.2.3', + 'version' => '0.3.0-dev.1', 'url' => 'https://github.com/appwrite/sdk-for-flutter', 'enabled' => true, 'beta' => true, diff --git a/app/sdks/client-flutter/CHANGELOG.md b/app/sdks/client-flutter/CHANGELOG.md index c9013a17eb..638d0882d2 100644 --- a/app/sdks/client-flutter/CHANGELOG.md +++ b/app/sdks/client-flutter/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.3.0-dev.1 + +- Updated package dependencies (@lohanidamodar) +- Added Flutter for Web compatibility (@lohanidamodar) + ## 0.2.3 - Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie diff --git a/app/sdks/client-flutter/README.md b/app/sdks/client-flutter/README.md index 877cf5d30f..95cdeae642 100644 --- a/app/sdks/client-flutter/README.md +++ b/app/sdks/client-flutter/README.md @@ -20,7 +20,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^0.2.3 + appwrite: ^0.3.0-dev.1 ``` You can install packages from the command line: diff --git a/app/sdks/client-flutter/lib/client.dart b/app/sdks/client-flutter/lib/client.dart index 7a53d0414b..1cf3ac8f0d 100644 --- a/app/sdks/client-flutter/lib/client.dart +++ b/app/sdks/client-flutter/lib/client.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; +import 'package:flutter/foundation.dart'; import 'package:dio/adapter.dart'; import 'package:dio_cookie_manager/dio_cookie_manager.dart'; import 'package:cookie_jar/cookie_jar.dart'; @@ -20,17 +21,21 @@ class Client { PersistCookieJar cookieJar; Client({this.endPoint = 'https://appwrite.io/v1', this.selfSigned = false, Dio http}) : this.http = http ?? Dio() { - - type = (Platform.isIOS) ? 'ios' : type; - type = (Platform.isMacOS) ? 'macos' : type; - type = (Platform.isAndroid) ? 'android' : type; - type = (Platform.isLinux) ? 'linux' : type; - type = (Platform.isWindows) ? 'windows' : type; - type = (Platform.isFuchsia) ? 'fuchsia' : type; + // Platform is not supported in web so if web, set type to web automatically and skip Platform check + if(kIsWeb) { + type = 'web'; + }else{ + type = (Platform.isIOS) ? 'ios' : type; + type = (Platform.isMacOS) ? 'macos' : type; + type = (Platform.isAndroid) ? 'android' : type; + type = (Platform.isLinux) ? 'linux' : type; + type = (Platform.isWindows) ? 'windows' : type; + type = (Platform.isFuchsia) ? 'fuchsia' : type; + } this.headers = { 'content-type': 'application/json', - 'x-sdk-version': 'appwrite:dart:0.2.3', + 'x-sdk-version': 'appwrite:flutter:0.3.0-dev.1', }; this.config = {}; @@ -78,17 +83,20 @@ class Client { Future init() async { if(!initialized) { - final Directory cookieDir = await _getCookiePath(); - - cookieJar = new PersistCookieJar(dir:cookieDir.path); + // if web skip cookie implementation and origin header as those are automatically handled by browsers + if(!kIsWeb) { + final Directory cookieDir = await _getCookiePath(); + cookieJar = new PersistCookieJar(dir:cookieDir.path); + this.http.interceptors.add(CookieManager(cookieJar)); + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName); + }else{ + // if web set httpClientAdapter as BrowserHttpClientAdapter with withCredentials true to make cookies work + this.http.options.extra['withCredentials'] = true; + } this.http.options.baseUrl = this.endPoint; this.http.options.validateStatus = (status) => status < 400; - this.http.interceptors.add(CookieManager(cookieJar)); - - PackageInfo packageInfo = await PackageInfo.fromPlatform(); - - addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName); } } @@ -114,6 +122,10 @@ class Client { } if (method == HttpMethod.get) { + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + return http.get(path, queryParameters: params, options: options); } else { return http.request(path, data: params, options: options); diff --git a/app/sdks/client-flutter/lib/services/avatars.dart b/app/sdks/client-flutter/lib/services/avatars.dart index fc9c403d90..828ea7dfb0 100644 --- a/app/sdks/client-flutter/lib/services/avatars.dart +++ b/app/sdks/client-flutter/lib/services/avatars.dart @@ -27,6 +27,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -55,6 +59,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -79,6 +87,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -106,6 +118,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -134,6 +150,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -161,6 +181,10 @@ class Avatars extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, diff --git a/app/sdks/client-flutter/lib/services/storage.dart b/app/sdks/client-flutter/lib/services/storage.dart index 696c15ee3a..51f9345050 100644 --- a/app/sdks/client-flutter/lib/services/storage.dart +++ b/app/sdks/client-flutter/lib/services/storage.dart @@ -124,6 +124,10 @@ class Storage extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -154,6 +158,10 @@ class Storage extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, @@ -178,6 +186,10 @@ class Storage extends Service { 'project': client.config['project'], }; + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + Uri endpoint = Uri.parse(client.endPoint); Uri location = new Uri(scheme: endpoint.scheme, host: endpoint.host, diff --git a/app/sdks/client-flutter/pubspec.yaml b/app/sdks/client-flutter/pubspec.yaml index 91a884cd2d..2d0c2fe412 100644 --- a/app/sdks/client-flutter/pubspec.yaml +++ b/app/sdks/client-flutter/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 0.2.3 +version: 0.3.0-dev.1 description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-flutter @@ -9,30 +9,15 @@ environment: sdk: '>=2.6.0 <3.0.0' dependencies: meta: ^1.1.8 - path_provider: ^1.6.5 - package_info: ^0.4.0+16 - dio: ^3.0.0 - cookie_jar: ^1.0.0 + path_provider: ^1.6.14 + package_info: ^0.4.3 + dio: ^3.0.10 + cookie_jar: ^1.0.1 dio_cookie_manager: ^1.0.0 flutter_web_auth: ^0.2.4 flutter: sdk: flutter - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 - dev_dependencies: flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. -flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. - uses-material-design: true \ No newline at end of file + sdk: flutter \ No newline at end of file diff --git a/docs/sdks/flutter/CHANGELOG.md b/docs/sdks/flutter/CHANGELOG.md index 945f6088ae..c252451f3f 100644 --- a/docs/sdks/flutter/CHANGELOG.md +++ b/docs/sdks/flutter/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.3.0 +## 0.3.0-dev.1 - Updated package dependencies (@lohanidamodar) - Added Flutter for Web compatibility (@lohanidamodar) From adffe2af3a855f1dc40b93144b6d1e39d6611ee6 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Sat, 5 Sep 2020 09:06:46 +0300 Subject: [PATCH 23/51] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b8905c1ad..9e54fcfb5c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

- +[![Hacktoberfest](https://badgen.net/badge/hacktoberfest/friendly/pink)](#contributing) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord)](https://discord.gg/GSeTUeA) [![Docker Pulls](https://badgen.net/docker/pulls/appwrite/appwrite)](https://travis-ci.org/appwrite/appwrite) [![Travis CI](https://badgen.net/travis/appwrite/appwrite?label=build)](https://travis-ci.org/appwrite/appwrite) From 7de9d08d85f379b1fbba22bb71369d8156486643 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Sat, 5 Sep 2020 09:23:56 +0300 Subject: [PATCH 24/51] Update CONTRIBUTING.md --- CONTRIBUTING.md | 94 +++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e6d85ab42..f362e3953e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,38 +6,28 @@ We would ❤️ for you to contribute to Appwrite and help make it better! We wa If you are worried or don’t know where to start, check out our next section explaining what kind of help we could use and where can you get involved. You can reach out with questions to [Eldad Fux (@eldadfux)](https://twitter.com/eldadfux) or [@appwrite_io](https://twitter.com/appwrite_io) on Twitter, and anyone from the [Appwrite team on Discord](https://discord.gg/GSeTUeA). You can also submit an issue, and a maintainer can guide you! -## Where to Start? - -Pull requests are great, but there are many other areas where you can help Appwrite. - -### Blogging & Speaking - -Blogging, speaking about, or creating tutorials about one of Appwrite’s many features. Mention [@appwrite_io](https://twitter.com/appwrite_io) on Twitter and/or email team [at] appwrite [dot] io so we can give pointers and tips and help you spread the word by promoting your content on the different Appwrite communication channels. Please add your blog posts and videos of talks to our [Awesome Appwrite]() repo on GitHub. - -### Presenting at Meetups - -Presenting at meetups and conferences about your Appwrite projects. Your unique challenges and successes in building things with Appwrite can provide great speaking material. We’d love to review your talk abstract/CFP, so get in touch with us if you’d like some help! - -### Sending Feedbacks & Reporting Bugs - -Sending feedback is a great way for us to understand your different use cases of Appwrite better. If you had any issues, bugs, or want to share about your experience, feel free to do so on our GitHub issues page or at our [Discord channel](https://discord.gg/GSeTUeA). - -### Submitting New Ideas - -If you think Appwrite could use a new feature, please open an issue on our GitHub repository, stating as much information as you can think about your new idea and it's implications. We would also use this issue to gather more information, get more feedback from the community, and have a proper discussion about the new feature. - -### Improving Documentation - -Submitting documentation updates, enhancements, designs, or bug fixes. Spelling or grammar fixes will be very much appreciated. - -### Helping Someone - -Searching for Appwrite on Discord, GitHub or StackOverflow and helping someone else who needs help. You can also help by reaching others how to contribute to Appwrite's repo! - ## Code of Conduct Help us keep Appwrite open and inclusive. Please read and follow our [Code of Conduct](/CODE_OF_CONDUCT.md). +## Setup From Source + +To set up a working **development environment**, just fork the project git repository and install the backend and frontend dependencies using the proper package manager and create run the docker-compose stack. + +> If you just want to install Appwrite for day-to-day usage and not as a code maintainer use this [installation guide](https://github.com/appwrite/appwrite#installation). + +Please note that these instructions are for setting a functional dev environment. If you want to set up an Appwrite instance to integrate into your app, you should probably try and install Appwrite by using the instructions in the [getting started guide](https://appwrite.io/docs/getting-started-for-web) or in the main [README](README.md) file. + +```bash +git clone git@github.com:[YOUR_FORK_HERE]/appwrite.git + +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. + ## Technology Stack To start helping us to improve the Appwrite server by submitting code, prior knowledge of Appwrite's technology stack can help you with getting started. @@ -125,24 +115,6 @@ This will allow the Appwrite community to have sufficient discussion about the n This is also important for the Appwrite lead developers to be able to give technical input and different emphasize regarding the feature design and architecture. -## Setup From Source - -To set up a working **development environment**, just fork the project git repository and install the backend and frontend dependencies using the proper package manager and create run the docker-compose stack. - -> If you just want to install Appwrite for day-to-day usage and not as a code maintainer use this [installation guide](https://github.com/appwrite/appwrite#installation). - -Please note that these instructions are for setting a functional dev environment. If you want to set up an Appwrite instance to integrate into your app, you should probably try and install Appwrite by using the instructions in the [getting started guide](https://appwrite.io/docs/getting-started-for-web) or in the main [README](README.md) file. - -```bash -git clone git@github.com:[YOUR_FORK_HERE]/appwrite.git - -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. - ## Build To build a new version of the Appwrite server, all you need to do is run the build.sh file like this: @@ -194,3 +166,33 @@ From time to time, our team will add tutorials that will help contributors find * [Adding Support for a New OAuth2 Provider](./docs/tutorials/add-oauth2-provider.md) * [Appwrite Environment Variables](./docs/tutorials/environment-variables.md) * [Running in Production](./docs/tutorials/running-in-production.md) + + +## Other Ways to Helo + +Pull requests are great, but there are many other areas where you can help Appwrite. + +### Blogging & Speaking + +Blogging, speaking about, or creating tutorials about one of Appwrite’s many features. Mention [@appwrite_io](https://twitter.com/appwrite_io) on Twitter and/or email team [at] appwrite [dot] io so we can give pointers and tips and help you spread the word by promoting your content on the different Appwrite communication channels. Please add your blog posts and videos of talks to our [Awesome Appwrite]() repo on GitHub. + +### Presenting at Meetups + +Presenting at meetups and conferences about your Appwrite projects. Your unique challenges and successes in building things with Appwrite can provide great speaking material. We’d love to review your talk abstract/CFP, so get in touch with us if you’d like some help! + +### Sending Feedbacks & Reporting Bugs + +Sending feedback is a great way for us to understand your different use cases of Appwrite better. If you had any issues, bugs, or want to share about your experience, feel free to do so on our GitHub issues page or at our [Discord channel](https://discord.gg/GSeTUeA). + +### Submitting New Ideas + +If you think Appwrite could use a new feature, please open an issue on our GitHub repository, stating as much information as you can think about your new idea and it's implications. We would also use this issue to gather more information, get more feedback from the community, and have a proper discussion about the new feature. + +### Improving Documentation + +Submitting documentation updates, enhancements, designs, or bug fixes. Spelling or grammar fixes will be very much appreciated. + +### Helping Someone + +Searching for Appwrite on Discord, GitHub or StackOverflow and helping someone else who needs help. You can also help by reaching others how to contribute to Appwrite's repo! + From 31dddc20b61c13af78197a8232cee270a7d95716 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Sat, 5 Sep 2020 09:28:21 +0300 Subject: [PATCH 25/51] Update CONTRIBUTING.md --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f362e3953e..26766ad50d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,6 +81,10 @@ When contributing code, please take into account the following considerations: Appwrite's current structure is a combination of both [Monolithic](https://en.wikipedia.org/wiki/Monolithic_application) and [Microservice](https://en.wikipedia.org/wiki/Microservices) architectures, but our final goal, as we grow, is to be using only microservices. +--- +![Appwrite](docs/specs/overview.drawio.svg) +--- + ### The Monolithic Part Appwrite's main API container is designed as a monolithic app. This is a decision we made to allow us to develop the project faster while still being a very small team. From 96931e349e1556258979f3c1ae0d0a19062f9b6b Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Sat, 5 Sep 2020 09:31:23 +0300 Subject: [PATCH 26/51] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26766ad50d..cae9769682 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -172,7 +172,7 @@ From time to time, our team will add tutorials that will help contributors find * [Running in Production](./docs/tutorials/running-in-production.md) -## Other Ways to Helo +## Other Ways to Help Pull requests are great, but there are many other areas where you can help Appwrite. From 0d6d76e68739f2354ed26c0a4f5a05302f176c84 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Sat, 5 Sep 2020 12:40:44 +0300 Subject: [PATCH 27/51] Update CONTRIBUTING.md --- CONTRIBUTING.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cae9769682..f918b450b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,6 +28,26 @@ 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. +## Architecture + +Appwrite's current structure is a combination of both [Monolithic](https://en.wikipedia.org/wiki/Monolithic_application) and [Microservice](https://en.wikipedia.org/wiki/Microservices) architectures, but our final goal, as we grow, is to be using only microservices. + +--- +![Appwrite](docs/specs/overview.drawio.svg) +--- + +### The Monolithic Part + +Appwrite's main API container is designed as a monolithic app. This is a decision we made to allow us to develop the project faster while still being a very small team. + +Although the Appwrite API is a monolithic app, it has a very clear separation of concern as each internal service or worker is separated by its container, which will allow us as we grow to start breaking services for better maintenance and scalability. + +### The Microservice Part + +Each container in Appwrite is a microservice on its own. Each service is an independent process that can scale without regard to any of the other services. + +Currently, all of the Appwrite microservices are intended to communicate using the TCP protocol over a private network. You should be aware to not expose any of the services to the public-facing network, besides the public port 80 and 443, who, by default, are used to expose the Appwrite HTTP API. + ## Technology Stack To start helping us to improve the Appwrite server by submitting code, prior knowledge of Appwrite's technology stack can help you with getting started. @@ -77,26 +97,6 @@ When contributing code, please take into account the following considerations: * Background Jobs * Task Execution Time -## Architecture - -Appwrite's current structure is a combination of both [Monolithic](https://en.wikipedia.org/wiki/Monolithic_application) and [Microservice](https://en.wikipedia.org/wiki/Microservices) architectures, but our final goal, as we grow, is to be using only microservices. - ---- -![Appwrite](docs/specs/overview.drawio.svg) ---- - -### The Monolithic Part - -Appwrite's main API container is designed as a monolithic app. This is a decision we made to allow us to develop the project faster while still being a very small team. - -Although the Appwrite API is a monolithic app, it has a very clear separation of concern as each internal service or worker is separated by its container, which will allow us as we grow to start breaking services for better maintenance and scalability. - -### The Microservice Part - -Each container in Appwrite is a microservice on its own. Each service is an independent process that can scale without regard to any of the other services. - -Currently, all of the Appwrite microservices are intended to communicate using the TCP protocol over a private network. You should be aware to not expose any of the services to the public-facing network, besides the public port 80 and 443, who, by default, are used to expose the Appwrite HTTP API. - ## Security & Privacy Security and privacy are extremely important to Appwrite, developers, and users alike. Make sure to follow the best industry standards and practices. From ba729a8a34578505225d3dbd357a0a2152154edc Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Sat, 5 Sep 2020 17:24:14 +0300 Subject: [PATCH 28/51] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e54fcfb5c..956c95a03c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

-[![Hacktoberfest](https://badgen.net/badge/hacktoberfest/friendly/pink)](#contributing) +[![Hacktoberfest](https://badgen.net/badge/hacktoberfest/friendly/pink)](CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord)](https://discord.gg/GSeTUeA) [![Docker Pulls](https://badgen.net/docker/pulls/appwrite/appwrite)](https://travis-ci.org/appwrite/appwrite) [![Travis CI](https://badgen.net/travis/appwrite/appwrite?label=build)](https://travis-ci.org/appwrite/appwrite) From ddd239d26ba0da9096e3ba6e2f6e2f1f0ee21e86 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Sat, 5 Sep 2020 20:52:34 +0300 Subject: [PATCH 29/51] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f918b450b6..e20c10f03c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -84,7 +84,7 @@ We use prettier for our JS coding standards and for auto-formatting our code. Appwrite is built to scale. Please keep in mind that the Appwrite stack can run in different environments and different scales. -We wish Appwrite will be as easy to set up and in a single, localhost, and easy to grow to a large environment with thousands and even hundreds of instances. +We wish Appwrite will be as easy to set up and in a single, localhost, and easy to grow to a large environment with dozens and even hundreds of instances. When contributing code, please take into account the following considerations: From 0d12c98a9462d371ad16f4cc15d3816e190bbfd3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 7 Sep 2020 08:10:26 +0300 Subject: [PATCH 30/51] Removed Docker fallbacks --- Dockerfile.alpine | 178 ----------------- Dockerfile.debian | 180 ----------------- Dockerfile.php8 | 178 ----------------- docker-compose.swoole.yml | 398 -------------------------------------- 4 files changed, 934 deletions(-) delete mode 100755 Dockerfile.alpine delete mode 100755 Dockerfile.debian delete mode 100755 Dockerfile.php8 delete mode 100644 docker-compose.swoole.yml diff --git a/Dockerfile.alpine b/Dockerfile.alpine deleted file mode 100755 index e60b97585c..0000000000 --- a/Dockerfile.alpine +++ /dev/null @@ -1,178 +0,0 @@ -FROM composer:2.0 as step0 - -ARG TESTING=false -ENV TESTING=$TESTING - -WORKDIR /usr/local/src/ - -COPY composer.lock /usr/local/src/ -COPY composer.json /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 php:8.0.0alpha1-cli-alpine as step1 - -ENV TZ=Asia/Tel_Aviv \ - DEBIAN_FRONTEND=noninteractive \ - PHP_REDIS_VERSION=5.3.0 \ - PHP_SWOOLE_VERSION=4.5.2 \ - PHP_XDEBUG_VERSION=sdebug_2_9-beta - -RUN \ - apk update && \ - apk add ca-certificates gcc make g++ autoconf wget git openssl make zip unzip brotli zlib - -RUN docker-php-ext-install sockets - -RUN \ - # 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 && \ - ./configure && \ - make && make install && \ - cd .. && \ - ## Swoole Extension - git clone https://github.com/swoole/swoole-src.git && \ - cd swoole-src && \ - #git checkout v$PHP_SWOOLE_VERSION && \ - phpize && \ - ./configure --enable-sockets --enable-http2 && \ - make && make install && \ - cd .. - ## XDebug Extension - # git clone https://github.com/swoole/sdebug.git && \ - # cd sdebug && \ - # git checkout $PHP_XDEBUG_VERSION && \ - # phpize && \ - # ./configure --enable-xdebug && \ - # make clean && make && make install - # cd .. && \ - # Meminfo Extension - # git clone https://github.com/BitOne/php-meminfo.git && \ - # cd php-meminfo && \ - # git checkout v1.0.5 && \ - # cd extension/php7 && \ - # phpize && \ - # ./configure --enable-meminfo && \ - # make && make install - -FROM php:8.0.0alpha1-cli-alpine as final - -LABEL maintainer="team@appwrite.io" - -ARG VERSION=dev - -ENV TZ=Asia/Tel_Aviv \ - DEBIAN_FRONTEND=noninteractive \ - _APP_SERVER=swoole \ - _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=100000000 \ - _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 '' - -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN \ - apk update && \ - apk add libwebp certbot htop procps \ - oniguruma libcurl imagemagick-libs yaml-dev brotli-libs zlib-dev - # pecl install imagick yaml && \ - # docker-php-ext-enable imagick yaml - -RUN docker-php-ext-install sockets curl opcache pdo pdo_mysql - -WORKDIR /usr/src/code - -COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor -COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190128/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20190128/ -COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190128/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20190128/ -# COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190128/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20190128/ -# COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190128/meminfo.so /usr/local/lib/php/extensions/no-debug-non-zts-20190128/ - -# Add 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 - -# Set Volumes -RUN mkdir -p /storage/uploads && \ - mkdir -p /storage/cache && \ - mkdir -p /storage/config && \ - mkdir -p /storage/certificates && \ - mkdir -p /storage/functions && \ - mkdir -p /storage/debug && \ - 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 && \ - chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug - -# Executables -RUN chmod +x /usr/local/bin/doctor -RUN chmod +x /usr/local/bin/migrate -RUN chmod +x /usr/local/bin/schedule -RUN chmod +x /usr/local/bin/test -RUN chmod +x /usr/local/bin/worker-audits -RUN chmod +x /usr/local/bin/worker-certificates -RUN chmod +x /usr/local/bin/worker-deletes -RUN chmod +x /usr/local/bin/worker-functions -RUN chmod +x /usr/local/bin/worker-mails -RUN chmod +x /usr/local/bin/worker-tasks -RUN chmod +x /usr/local/bin/worker-usage -RUN chmod +x /usr/local/bin/worker-webhooks - -# Letsencrypt Permissions -RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/ - -# Enable Extensions -RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini -RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini -# RUN echo zend_extension=xdebug.so >> /usr/local/etc/php/conf.d/xdebug.ini -# RUN echo extension=meminfo.so >> /usr/local/etc/php/conf.d/meminfo.ini - -RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.enable_cli = 1" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.profiler_enable = 1" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.profiler_output_dir = /tmp/" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.profiler_enable_trigger = 1" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.trace_format = 1" >> /usr/local/etc/php/conf.d/appwrite.ini - -EXPOSE 80 - -#, "-dxdebug.auto_trace=1" -#, "-dxdebug.profiler_enable=1" -#, "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" - -CMD [ "php", "app/server.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ] \ No newline at end of file diff --git a/Dockerfile.debian b/Dockerfile.debian deleted file mode 100755 index 0d55f0a6f5..0000000000 --- a/Dockerfile.debian +++ /dev/null @@ -1,180 +0,0 @@ -FROM composer:2.0 as step0 - -ARG TESTING=false -ENV TESTING=$TESTING - -WORKDIR /usr/local/src/ - -COPY composer.lock /usr/local/src/ -COPY composer.json /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 php:7.4-cli as step1 - -ENV TZ=Asia/Tel_Aviv \ - DEBIAN_FRONTEND=noninteractive \ - PHP_REDIS_VERSION=5.3.0 \ - PHP_SWOOLE_VERSION=4.5.2 \ - PHP_XDEBUG_VERSION=sdebug_2_9-beta - -RUN \ - apt-get update && \ - apt-get install -y --no-install-recommends --no-install-suggests ca-certificates software-properties-common wget git openssl make zip unzip libbrotli-dev libz-dev - -RUN docker-php-ext-install sockets - -RUN \ - # 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 && \ - ./configure && \ - make && make install && \ - cd .. && \ - ## Swoole Extension - git clone https://github.com/swoole/swoole-src.git && \ - cd swoole-src && \ - git checkout v$PHP_SWOOLE_VERSION && \ - phpize && \ - ./configure --enable-sockets --enable-http2 && \ - make && make install && \ - cd .. - ## XDebug Extension - # git clone https://github.com/swoole/sdebug.git && \ - # cd sdebug && \ - # git checkout $PHP_XDEBUG_VERSION && \ - # phpize && \ - # ./configure --enable-xdebug && \ - # make clean && make && make install - # cd .. && \ - # Meminfo Extension - # git clone https://github.com/BitOne/php-meminfo.git && \ - # cd php-meminfo && \ - # git checkout v1.0.5 && \ - # cd extension/php7 && \ - # phpize && \ - # ./configure --enable-meminfo && \ - # make && make install - -FROM php:7.4-cli as final - -LABEL maintainer="team@appwrite.io" - -ARG VERSION=dev - -ENV TZ=Asia/Tel_Aviv \ - DEBIAN_FRONTEND=noninteractive \ - _APP_SERVER=swoole \ - _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=100000000 \ - _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_FUNCTIONS_TIMEOUT=900 \ - _APP_FUNCTIONS_CONTAINERS=10 \ - _APP_SETUP=self-hosted \ - _APP_VERSION=$VERSION -#ENV _APP_SMTP_SECURE '' -#ENV _APP_SMTP_USERNAME '' -#ENV _APP_SMTP_PASSWORD '' - -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 webp certbot htop procps docker.io \ - libonig-dev libcurl4-gnutls-dev libmagickwand-dev libyaml-dev libbrotli-dev libz-dev && \ - pecl install imagick yaml && \ - docker-php-ext-enable imagick yaml - -RUN docker-php-ext-install sockets curl opcache pdo pdo_mysql - -WORKDIR /usr/src/code - -COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor -COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ -COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ -# COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ -# COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/meminfo.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ - -# Add 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 - -# Set Volumes -RUN mkdir -p /storage/uploads && \ - mkdir -p /storage/cache && \ - mkdir -p /storage/config && \ - mkdir -p /storage/certificates && \ - mkdir -p /storage/functions && \ - mkdir -p /storage/debug && \ - 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 && \ - chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug - -# Executables -RUN chmod +x /usr/local/bin/doctor -RUN chmod +x /usr/local/bin/migrate -RUN chmod +x /usr/local/bin/schedule -RUN chmod +x /usr/local/bin/test -RUN chmod +x /usr/local/bin/worker-audits -RUN chmod +x /usr/local/bin/worker-certificates -RUN chmod +x /usr/local/bin/worker-deletes -RUN chmod +x /usr/local/bin/worker-functions -RUN chmod +x /usr/local/bin/worker-mails -RUN chmod +x /usr/local/bin/worker-tasks -RUN chmod +x /usr/local/bin/worker-usage -RUN chmod +x /usr/local/bin/worker-webhooks - -# Letsencrypt Permissions -RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/ - -# Enable Extensions -RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini -RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini -# RUN echo zend_extension=xdebug.so >> /usr/local/etc/php/conf.d/xdebug.ini -# RUN echo extension=meminfo.so >> /usr/local/etc/php/conf.d/meminfo.ini - -RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.enable_cli = 1" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.profiler_enable = 1" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.profiler_output_dir = /tmp/" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.profiler_enable_trigger = 1" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.trace_format = 1" >> /usr/local/etc/php/conf.d/appwrite.ini - -EXPOSE 80 - -#, "-dxdebug.auto_trace=1" -#, "-dxdebug.profiler_enable=1" -#, "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" - -CMD [ "php", "app/server.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ] \ No newline at end of file diff --git a/Dockerfile.php8 b/Dockerfile.php8 deleted file mode 100755 index 2cc74ef76d..0000000000 --- a/Dockerfile.php8 +++ /dev/null @@ -1,178 +0,0 @@ -FROM composer:2.0 as step0 - -ARG TESTING=false -ENV TESTING=$TESTING - -WORKDIR /usr/local/src/ - -COPY composer.lock /usr/local/src/ -COPY composer.json /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 php:8.0-rc as step1 - -ENV TZ=Asia/Tel_Aviv \ - DEBIAN_FRONTEND=noninteractive \ - PHP_REDIS_VERSION=5.3.0 \ - PHP_SWOOLE_VERSION=4.5.2 \ - PHP_XDEBUG_VERSION=sdebug_2_9-beta - -RUN \ - apt-get update && \ - apt-get install -y --no-install-recommends --no-install-suggests ca-certificates software-properties-common wget git openssl make zip unzip libbrotli-dev libz-dev - -RUN docker-php-ext-install sockets - -RUN \ - # 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 && \ - ./configure && \ - make && make install && \ - cd .. && \ - ## Swoole Extension - git clone https://github.com/swoole/swoole-src.git && \ - cd swoole-src && \ - #git checkout v$PHP_SWOOLE_VERSION && \ - phpize && \ - ./configure --enable-sockets --enable-http2 && \ - make && make install && \ - cd .. - ## XDebug Extension - # git clone https://github.com/swoole/sdebug.git && \ - # cd sdebug && \ - # git checkout $PHP_XDEBUG_VERSION && \ - # phpize && \ - # ./configure --enable-xdebug && \ - # make clean && make && make install - # cd .. && \ - # Meminfo Extension - # git clone https://github.com/BitOne/php-meminfo.git && \ - # cd php-meminfo && \ - # git checkout v1.0.5 && \ - # cd extension/php7 && \ - # phpize && \ - # ./configure --enable-meminfo && \ - # make && make install - -FROM php:8.0-rc as final - -LABEL maintainer="team@appwrite.io" - -ARG VERSION=dev - -ENV TZ=Asia/Tel_Aviv \ - DEBIAN_FRONTEND=noninteractive \ - _APP_SERVER=swoole \ - _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=100000000 \ - _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 '' - -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 webp certbot htop procps \ - libonig-dev libcurl4-gnutls-dev libmagickwand-dev libyaml-dev libbrotli-dev libz-dev - # pecl install imagick yaml && \ - # docker-php-ext-enable imagick yaml - -RUN docker-php-ext-install sockets curl opcache pdo pdo_mysql - -WORKDIR /usr/src/code - -COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor -COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ -COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ -# COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ -# COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/meminfo.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ - -# Add 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 - -# Set Volumes -RUN mkdir -p /storage/uploads && \ - mkdir -p /storage/cache && \ - mkdir -p /storage/config && \ - mkdir -p /storage/certificates && \ - mkdir -p /storage/functions && \ - mkdir -p /storage/debug && \ - 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 && \ - chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug - -# Executables -RUN chmod +x /usr/local/bin/doctor -RUN chmod +x /usr/local/bin/migrate -RUN chmod +x /usr/local/bin/schedule -RUN chmod +x /usr/local/bin/test -RUN chmod +x /usr/local/bin/worker-audits -RUN chmod +x /usr/local/bin/worker-certificates -RUN chmod +x /usr/local/bin/worker-deletes -RUN chmod +x /usr/local/bin/worker-functions -RUN chmod +x /usr/local/bin/worker-mails -RUN chmod +x /usr/local/bin/worker-tasks -RUN chmod +x /usr/local/bin/worker-usage -RUN chmod +x /usr/local/bin/worker-webhooks - -# Letsencrypt Permissions -RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/ - -# Enable Extensions -RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini -RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini -# RUN echo zend_extension=xdebug.so >> /usr/local/etc/php/conf.d/xdebug.ini -# RUN echo extension=meminfo.so >> /usr/local/etc/php/conf.d/meminfo.ini - -RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini -RUN echo "opcache.enable_cli = 1" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.profiler_enable = 1" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.profiler_output_dir = /tmp/" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.profiler_enable_trigger = 1" >> /usr/local/etc/php/conf.d/appwrite.ini -# RUN echo "xdebug.trace_format = 1" >> /usr/local/etc/php/conf.d/appwrite.ini - -EXPOSE 80 - -#, "-dxdebug.auto_trace=1" -#, "-dxdebug.profiler_enable=1" -#, "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" - -CMD [ "php", "app/server.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ] \ No newline at end of file diff --git a/docker-compose.swoole.yml b/docker-compose.swoole.yml deleted file mode 100644 index 7acda9ee5f..0000000000 --- a/docker-compose.swoole.yml +++ /dev/null @@ -1,398 +0,0 @@ -version: '3' - -services: - traefik: - image: traefik:2.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 - ports: - - 9501:80 - networks: - - appwrite - labels: - - traefik.http.routers.appwrite.rule=PathPrefix(`/`) - - 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 - - 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 - - ./debug:/tmp - depends_on: - - mariadb - - redis - - clamav - - influxdb - environment: - - _APP_ENV - - _APP_OPTIONS_ABUSE - - _APP_OPTIONS_FORCE_HTTPS - - _APP_OPENSSL_KEY_V1 - - _APP_DOMAIN - - _APP_DOMAIN_TARGET - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS - - _APP_INFLUXDB_HOST - - _APP_INFLUXDB_PORT - - appwrite-worker-usage: - entrypoint: worker-usage - container_name: appwrite-worker-usage - build: - context: . - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - - telegraf - environment: - - _APP_ENV - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_STATSD_HOST - - _APP_STATSD_PORT - - appwrite-worker-audits: - entrypoint: worker-audits - container_name: appwrite-worker-audits - build: - context: . - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - - mariadb - environment: - - _APP_ENV - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS - - appwrite-worker-webhooks: - entrypoint: worker-webhooks - container_name: appwrite-worker-webhooks - build: - context: . - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - - mariadb - environment: - - _APP_ENV - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS - - appwrite-worker-tasks: - entrypoint: worker-tasks - container_name: appwrite-worker-tasks - build: - context: . - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - - mariadb - environment: - - _APP_ENV - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS - - appwrite-worker-deletes: - entrypoint: worker-deletes - container_name: appwrite-worker-deletes - build: - context: . - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - - mariadb - volumes: - - appwrite-uploads:/storage/uploads:rw - - appwrite-cache:/storage/cache:rw - environment: - - _APP_ENV - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS - - appwrite-worker-certificates: - entrypoint: worker-certificates - container_name: appwrite-worker-certificates - build: - context: . - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - - mariadb - volumes: - - appwrite-config:/storage/config:rw - - appwrite-certificates:/storage/certificates:rw - environment: - - _APP_ENV - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS - - appwrite-worker-functions: - entrypoint: worker-functions - container_name: appwrite-worker-functions - build: - context: . - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - - mariadb - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - appwrite-functions:/storage/functions:rw - environment: - - _APP_ENV - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - appwrite-worker-mails: - entrypoint: worker-mails - container_name: appwrite-worker-mails - build: - context: . - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - - maildev - # - smtp - environment: - - _APP_ENV - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_SMTP_HOST - - _APP_SMTP_PORT - - appwrite-schedule: - entrypoint: schedule - container_name: appwrite-schedule - build: - context: . - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - environment: - - _APP_ENV - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - mariadb: - image: appwrite/mariadb:1.0.3 # 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.0.12 - 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 - - # webgrind: - # image: 'jokkedk/webgrind:latest' - # volumes: - # - './debug:/tmp' - # ports: - # - '3001:80' - -networks: - gateway: - appwrite: - -volumes: - appwrite-mariadb: - appwrite-redis: - appwrite-cache: - appwrite-uploads: - appwrite-certificates: - appwrite-functions: - appwrite-influxdb: - appwrite-chronograf: - appwrite-config: From 77667be404e1f16e00c2994961dd9ccea777f741 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 8 Sep 2020 00:28:40 +0300 Subject: [PATCH 31/51] Changes all name attributes length to max of 128 chars --- CHANGES.md | 8 ++++++++ app/controllers/api/account.php | 4 ++-- app/controllers/api/avatars.php | 2 +- app/controllers/api/database.php | 4 ++-- app/controllers/api/functions.php | 4 ++-- app/controllers/api/projects.php | 22 ++++++++++----------- app/controllers/api/teams.php | 6 +++--- app/controllers/api/users.php | 2 +- app/views/console/account/index.phtml | 2 +- app/views/console/comps/header.phtml | 2 +- app/views/console/database/collection.phtml | 2 +- app/views/console/database/index.phtml | 2 +- app/views/console/functions/function.phtml | 2 +- app/views/console/functions/index.phtml | 2 +- app/views/console/home/index.phtml | 12 +++++------ app/views/console/keys/index.phtml | 4 ++-- app/views/console/settings/index.phtml | 4 ++-- app/views/console/tasks/index.phtml | 4 ++-- app/views/console/users/index.phtml | 4 ++-- app/views/console/users/team.phtml | 4 ++-- app/views/console/webhooks/index.phtml | 4 ++-- app/views/home/auth/signup.phtml | 2 +- 22 files changed, 55 insertions(+), 47 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3b3c93ea41..6ae5135ef7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,14 @@ - Added pagination for projects list on the console home page. - Updated storage calculation to match IEC standards - Now using Alpine as base Docker image +- User name max length is now 128 chars and not 100 for better API consistency +- 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 +- Webhook name max length is now 128 chars and not 256 for better API consistency +- 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 - 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) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 48ad948263..455d0420e7 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -53,7 +53,7 @@ App::post('/v1/account') ->label('abuse-limit', 10) ->param('email', '', function () { return new Email(); }, 'User email.') ->param('password', '', function () { return new Password(); }, 'User password. Must be between 6 to 32 chars.') - ->param('name', '', function () { return new Text(100); }, 'User name.', true) + ->param('name', '', function () { return new Text(128); }, 'User name. Max length: 128 chars.', true) ->action(function ($email, $password, $name, $request, $response, $project, $projectDB, $webhooks, $audits) use ($oauth2Keys) { /** @var Utopia\Request $request */ /** @var Utopia\Response $response */ @@ -738,7 +738,7 @@ App::patch('/v1/account/name') ->label('sdk.namespace', 'account') ->label('sdk.method', 'updateName') ->label('sdk.description', '/docs/references/account/update-name.md') - ->param('name', '', function () { return new Text(100); }, 'User name.') + ->param('name', '', function () { return new Text(128); }, 'User name. Max length: 128 chars.') ->action(function ($name, $response, $user, $projectDB, $audits) use ($oauth2Keys) { /** @var Utopia\Response $response */ /** @var Appwrite\Database\Document $user */ diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index fb8055870c..bf765f520c 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -393,7 +393,7 @@ App::get('/v1/avatars/initials') ->label('sdk.method', 'getInitials') ->label('sdk.methodType', 'location') ->label('sdk.description', '/docs/references/avatars/get-initials.md') - ->param('name', '', function () { return new Text(512); }, 'Full Name. When empty, current user name or email will be used.', true) + ->param('name', '', function () { return new Text(128); }, 'Full Name. When empty, current user name or email will be used. Max length: 128 chars.', true) ->param('width', 500, function () { return new Range(0, 2000); }, 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('height', 500, function () { return new Range(0, 2000); }, 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('color', '', function () { return new HexColor(); }, 'Changes text color. By default a random color will be picked and stay will persistent to the given name.', true) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index b455106bda..2b0631c329 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -30,7 +30,7 @@ App::post('/v1/database/collections') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.method', 'createCollection') ->label('sdk.description', '/docs/references/database/create-collection.md') - ->param('name', '', function () { return new Text(256); }, 'Collection name.') + ->param('name', '', function () { return new Text(128); }, 'Collection name. Max length: 128 chars.') ->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('rules', [], function ($projectDB) { return new ArrayList(new Collection($projectDB, [Database::SYSTEM_COLLECTION_RULES], ['$collection' => Database::SYSTEM_COLLECTION_RULES, '$permissions' => ['read' => [], 'write' => []]])); }, 'Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation.', false, ['projectDB']) @@ -226,7 +226,7 @@ App::put('/v1/database/collections/:collectionId') ->label('sdk.method', 'updateCollection') ->label('sdk.description', '/docs/references/database/update-collection.md') ->param('collectionId', '', function () { return new UID(); }, 'Collection unique ID.') - ->param('name', null, function () { return new Text(256); }, 'Collection name.') + ->param('name', null, function () { return new Text(128); }, 'Collection name. Max length: 128 chars.') ->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions(/docs/permissions) and get a full list of available permissions.') ->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('rules', [], function ($projectDB) { return new ArrayList(new Collection($projectDB, [Database::SYSTEM_COLLECTION_RULES], ['$collection' => Database::SYSTEM_COLLECTION_RULES, '$permissions' => ['read' => [], 'write' => []]])); }, 'Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation.', true, ['projectDB']) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 6118fa6dcc..f960a66d20 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -28,7 +28,7 @@ App::post('/v1/functions') ->label('sdk.namespace', 'functions') ->label('sdk.method', 'create') ->label('sdk.description', '/docs/references/functions/create-function.md') - ->param('name', '', function () { return new Text(128); }, 'Function name.') + ->param('name', '', function () { return new Text(128); }, 'Function name. Max length: 128 chars.') ->param('env', '', function () { return new WhiteList(array_keys(Config::getParam('environments'))); }, 'Execution enviornment.') ->param('vars', [], function () { return new Assoc();}, 'Key-value JSON object.', true) ->param('events', [], function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)); }, 'Events list.', true) @@ -121,7 +121,7 @@ App::put('/v1/functions/:functionId') ->label('sdk.method', 'update') ->label('sdk.description', '/docs/references/functions/update-function.md') ->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') - ->param('name', '', function () { return new Text(128); }, 'Function name.') + ->param('name', '', function () { return new Text(128); }, 'Function name. Max length: 128 chars.') ->param('vars', [], function () { return new Assoc();}, 'Key-value JSON object.', true) ->param('events', [], function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)); }, 'Events list.', true) ->param('schedule', '', function () { return new Cron(); }, 'Schedule CRON syntax.', true) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 5da7be03f3..a5179359db 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -27,7 +27,7 @@ App::post('/v1/projects') ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'create') - ->param('name', null, function () { return new Text(100); }, 'Project name.') + ->param('name', null, function () { return new Text(128); }, 'Project name. Max length: 128 chars.') ->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('description', '', function () { return new Text(255); }, 'Project description.', true) ->param('logo', '', function () { return new Text(1024); }, 'Project logo.', true) @@ -335,8 +335,8 @@ App::patch('/v1/projects/:projectId') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'update') ->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') - ->param('name', null, function () { return new Text(100); }, 'Project name.') - ->param('description', '', function () { return new Text(255); }, 'Project description.', true) + ->param('name', null, function () { return new Text(128); }, 'Project name. Max length: 128 chars.') + ->param('description', '', function () { return new Text(256); }, 'Project description. Max length: 256 chars.', true) ->param('logo', '', function () { return new Text(1024); }, 'Project logo.', true) ->param('url', '', function () { return new URL(); }, 'Project URL.', true) ->param('legalName', '', function () { return new Text(256); }, 'Project legal name.', true) @@ -474,7 +474,7 @@ App::post('/v1/projects/:projectId/webhooks') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'createWebhook') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') - ->param('name', null, function () { return new Text(256); }, 'Webhook name.') + ->param('name', null, function () { return new Text(128); }, 'Webhook name. Max length: 128 chars.') ->param('events', null, function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)); }, 'Events list.') ->param('url', null, function () { return new URL(); }, 'Webhook URL.') ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') @@ -610,7 +610,7 @@ App::put('/v1/projects/:projectId/webhooks/:webhookId') ->label('sdk.method', 'updateWebhook') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('webhookId', null, function () { return new UID(); }, 'Webhook unique ID.') - ->param('name', null, function () { return new Text(256); }, 'Webhook name.') + ->param('name', null, function () { return new Text(128); }, 'Webhook name. Max length: 128 chars.') ->param('events', null, function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)); }, 'Events list.') ->param('url', null, function () { return new URL(); }, 'Webhook URL.') ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user.', true) @@ -699,7 +699,7 @@ App::post('/v1/projects/:projectId/keys') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'createKey') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') - ->param('name', null, function () { return new Text(256); }, 'Key name.') + ->param('name', null, function () { return new Text(128); }, 'Key name. Max length: 128 chars.') ->param('scopes', null, function () { return new ArrayList(new WhiteList(Config::getParam('scopes'))); }, 'Key scopes list.') ->action(function ($projectId, $name, $scopes, $response, $consoleDB) { /** @var Utopia\Response $response */ @@ -792,7 +792,7 @@ App::put('/v1/projects/:projectId/keys/:keyId') ->label('sdk.method', 'updateKey') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('keyId', null, function () { return new UID(); }, 'Key unique ID.') - ->param('name', null, function () { return new Text(256); }, 'Key name.') + ->param('name', null, function () { return new Text(128); }, 'Key name. Max length: 128 chars.') ->param('scopes', null, function () { return new ArrayList(new WhiteList(Config::getParam('scopes'))); }, 'Key scopes list') ->action(function ($projectId, $keyId, $name, $scopes, $response, $consoleDB) { /** @var Utopia\Response $response */ @@ -862,7 +862,7 @@ App::post('/v1/projects/:projectId/tasks') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'createTask') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') - ->param('name', null, function () { return new Text(256); }, 'Task name.') + ->param('name', null, function () { return new Text(128); }, 'Task name. Max length: 128 chars.') ->param('status', null, function () { return new WhiteList(['play', 'pause']); }, 'Task status.') ->param('schedule', null, function () { return new Cron(); }, 'Task schedule CRON syntax.') ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') @@ -1016,7 +1016,7 @@ App::put('/v1/projects/:projectId/tasks/:taskId') ->label('sdk.method', 'updateTask') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('taskId', null, function () { return new UID(); }, 'Task unique ID.') - ->param('name', null, function () { return new Text(256); }, 'Task name.') + ->param('name', null, function () { return new Text(128); }, 'Task name. Max length: 128 chars.') ->param('status', null, function () { return new WhiteList(['play', 'pause']); }, 'Task status.') ->param('schedule', null, function () { return new Cron(); }, 'Task schedule CRON syntax.') ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') @@ -1122,7 +1122,7 @@ App::post('/v1/projects/:projectId/platforms') ->label('sdk.method', 'createPlatform') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('type', null, function () { return new WhiteList(['web', 'flutter-ios', 'flutter-android', 'ios', 'android', 'unity']); }, 'Platform type.') - ->param('name', null, function () { return new Text(256); }, 'Platform name.') + ->param('name', null, function () { return new Text(128); }, 'Platform name. Max length: 128 chars.') ->param('key', '', function () { return new Text(256); }, 'Package name for android or bundle ID for iOS.', true) ->param('store', '', function () { return new Text(256); }, 'App store or Google Play store ID.', true) ->param('hostname', '', function () { return new Text(256); }, 'Platform client hostname.', true) @@ -1226,7 +1226,7 @@ App::put('/v1/projects/:projectId/platforms/:platformId') ->label('sdk.method', 'updatePlatform') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('platformId', null, function () { return new UID(); }, 'Platform unique ID.') - ->param('name', null, function () { return new Text(256); }, 'Platform name.') + ->param('name', null, function () { return new Text(128); }, 'Platform name. Max length: 128 chars.') ->param('key', '', function () { return new Text(256); }, 'Package name for android or bundle ID for iOS.', true) ->param('store', '', function () { return new Text(256); }, 'App store or Google Play store ID.', true) ->param('hostname', '', function () { return new Text(256); }, 'Platform client URL.', true) diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 159b0d2689..6ae2cbbb1a 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -26,7 +26,7 @@ App::post('/v1/teams') ->label('sdk.namespace', 'teams') ->label('sdk.method', 'create') ->label('sdk.description', '/docs/references/teams/create-team.md') - ->param('name', null, function () { return new Text(100); }, 'Team name.') + ->param('name', null, function () { return new Text(128); }, 'Team name. Max length: 128 chars.') ->param('roles', ['owner'], function () { return new ArrayList(new Text(128)); }, 'Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions).', true) ->action(function ($name, $roles, $response, $user, $projectDB, $mode) { /** @var Utopia\Response $response */ @@ -147,7 +147,7 @@ App::put('/v1/teams/:teamId') ->label('sdk.method', 'update') ->label('sdk.description', '/docs/references/teams/update-team.md') ->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') - ->param('name', null, function () { return new Text(100); }, 'Team name.') + ->param('name', null, function () { return new Text(128); }, 'Team name. Max length: 128 chars.') ->action(function ($teamId, $name, $response, $projectDB) { /** @var Utopia\Response $response */ /** @var Appwrite\Database\Database $projectDB */ @@ -220,7 +220,7 @@ App::post('/v1/teams/:teamId/memberships') ->label('sdk.description', '/docs/references/teams/create-team-membership.md') ->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('email', '', function () { return new Email(); }, 'New team member email.') - ->param('name', '', function () { return new Text(100); }, 'New team member name.', true) + ->param('name', '', function () { return new Text(128); }, 'New team member name. Max length: 128 chars.', true) ->param('roles', [], function () { return new ArrayList(new Text(128)); }, 'Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions).') ->param('url', '', function ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', false, ['clients']) // TODO add our own built-in confirm page ->action(function ($teamId, $email, $name, $roles, $url, $response, $project, $user, $projectDB, $locale, $audits, $mails, $mode) { diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 551fffb643..6eb8137c01 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -28,7 +28,7 @@ App::post('/v1/users') ->label('sdk.description', '/docs/references/users/create-user.md') ->param('email', '', function () { return new Email(); }, 'User email.') ->param('password', '', function () { return new Password(); }, 'User password. Must be between 6 to 32 chars.') - ->param('name', '', function () { return new Text(100); }, 'User name.', true) + ->param('name', '', function () { return new Text(128); }, 'User name. Max length: 128 chars.', true) ->action(function ($email, $password, $name, $response, $projectDB) { /** @var Utopia\Response $response */ /** @var Appwrite\Database\Database $projectDB */ diff --git a/app/views/console/account/index.phtml b/app/views/console/account/index.phtml index c8c86f729f..e14f73b749 100644 --- a/app/views/console/account/index.phtml +++ b/app/views/console/account/index.phtml @@ -46,7 +46,7 @@
- +
diff --git a/app/views/console/comps/header.phtml b/app/views/console/comps/header.phtml index 921a9c933e..ead2423b25 100644 --- a/app/views/console/comps/header.phtml +++ b/app/views/console/comps/header.phtml @@ -218,7 +218,7 @@

Appwrite projects are containers for your resources and apps across different platforms.

- +