From ed268340da3e83b8a616063ea7a23c529acb5d3c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 10 Apr 2020 21:59:14 +0300 Subject: [PATCH] Updated methods labels --- app/controllers/api/account.php | 15 +++- app/controllers/api/storage.php | 7 +- .../.dart_tool/package_config.json | 86 ++++++++++++++++++ app/sdks/flutter-dart/.packages | 14 +++ app/sdks/flutter-dart/pubspec.lock | 89 +++++++++++++++++++ 5 files changed, 204 insertions(+), 7 deletions(-) create mode 100644 app/sdks/flutter-dart/.dart_tool/package_config.json create mode 100644 app/sdks/flutter-dart/.packages create mode 100644 app/sdks/flutter-dart/pubspec.lock diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index a87086de1a..8d92e1d662 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -24,6 +24,7 @@ use Appwrite\Database\Validator\UID; use Appwrite\Database\Validator\Authorization; use Appwrite\Template\Template; use Appwrite\OpenSSL\OpenSSL; +use Appwrite\URL\URL as URLParser; use DeviceDetector\DeviceDetector; use GeoIp2\Database\Reader; @@ -246,7 +247,7 @@ $utopia->get('/v1/account/sessions/oauth2/:provider') ->label('sdk.description', '/docs/references/account/create-session-oauth2.md') ->label('sdk.response.code', 301) ->label('sdk.response.type', 'text/html') - ->label('sdk.location', true) + ->label('sdk.methodType', 'webAuth') ->label('abuse-limit', 50) ->label('abuse-key', 'ip:{ip}') ->param('provider', '', function () { return new WhiteList(array_keys(Config::getParam('providers'))); }, 'OAuth2 Provider. Currently, supported providers are: ' . implode(', ', array_keys(array_filter(Config::getParam('providers'), function($node) {return (!$node['mock']);}))).'.') @@ -267,7 +268,7 @@ $utopia->get('/v1/account/sessions/oauth2/:provider') } if (empty($appId) || empty($appSecret)) { - throw new Exception('Provider is undefined, configure provider app ID and app secret key to continue', 412); + throw new Exception('This provider is disabled. Please configure the provider app ID and app secret key from your '.APP_NAME.' console to continue.', 412); } $classname = 'Appwrite\\Auth\\OAuth2\\'.ucfirst($provider); @@ -480,7 +481,13 @@ $utopia->get('/v1/account/sessions/oauth2/:provider/redirect') } if($state['success'] === $oauthDefaultSuccess) { // Add keys for non-web platforms - $state['success'] = $state['success'].'/?end=true'; + $state['success'] = URLParser::parse($state['success']); + $query = URLParser::parseQuery($state['success']['query']); + $query['domain'] = COOKIE_DOMAIN; + $query['key'] = Auth::$cookieName; + $query['secret'] = Auth::encodeSession($user->getId(), $secret); + $state['success']['query'] = URLParser::unparseQuery($query); + $state['success'] = URLParser::unparse($state['success']); } $response @@ -502,7 +509,7 @@ $utopia->get('/v1/account') ->label('sdk.description', '/docs/references/account/get.md') ->label('sdk.response', ['200' => 'user']) ->action( - function () use ($response, &$user, $oauth2Keys) { + function () use ($response, &$user, $oauth2Keys) { $response->json(array_merge($user->getArrayCopy(array_merge( [ '$id', diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 4a84dbf8dd..f8f8221f65 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -142,6 +142,7 @@ $utopia->post('/v1/storage/files') ->label('sdk.method', 'createFile') ->label('sdk.description', '/docs/references/storage/create-file.md') ->label('sdk.consumes', 'multipart/form-data') + ->label('sdk.methodType', 'upload') ->param('file', [], function () { return new File(); }, 'Binary File.', false) ->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.') @@ -328,7 +329,7 @@ $utopia->get('/v1/storage/files/:fileId/preview') ->label('sdk.method', 'getFilePreview') ->label('sdk.description', '/docs/references/storage/get-file-preview.md') ->label('sdk.response.type', 'image/*') - ->label('sdk.location', true) + ->label('sdk.methodType', 'location') ->param('fileId', '', function () { return new UID(); }, 'File unique ID') ->param('width', 0, function () { return new Range(0, 4000); }, 'Resize preview image width, Pass an integer between 0 to 4000.', true) ->param('height', 0, function () { return new Range(0, 4000); }, 'Resize preview image height, Pass an integer between 0 to 4000.', true) @@ -452,7 +453,7 @@ $utopia->get('/v1/storage/files/:fileId/download') ->label('sdk.method', 'getFileDownload') ->label('sdk.description', '/docs/references/storage/get-file-download.md') ->label('sdk.response.type', '*') - ->label('sdk.location', true) + ->label('sdk.methodType', 'location') ->param('fileId', '', function () { return new UID(); }, 'File unique ID.') ->action( function ($fileId) use ($response, $request, $projectDB) { @@ -505,7 +506,7 @@ $utopia->get('/v1/storage/files/:fileId/view') ->label('sdk.method', 'getFileView') ->label('sdk.description', '/docs/references/storage/get-file-view.md') ->label('sdk.response.type', '*') - ->label('sdk.location', true) + ->label('sdk.methodType', 'location') ->param('fileId', '', function () { return new UID(); }, 'File unique ID.') ->param('as', '', function () { return new WhiteList(['pdf', /*'html',*/ 'text']); }, '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.', true) ->action( diff --git a/app/sdks/flutter-dart/.dart_tool/package_config.json b/app/sdks/flutter-dart/.dart_tool/package_config.json new file mode 100644 index 0000000000..79f1f8fa5a --- /dev/null +++ b/app/sdks/flutter-dart/.dart_tool/package_config.json @@ -0,0 +1,86 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "charcode", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.3", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "collection", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/collection-1.14.12", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "cookie_jar", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/cookie_jar-1.0.1", + "packageUri": "lib/", + "languageVersion": "1.20" + }, + { + "name": "dio", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/dio-3.0.9", + "packageUri": "lib/", + "languageVersion": "2.4" + }, + { + "name": "dio_cookie_manager", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/dio_cookie_manager-1.0.0", + "packageUri": "lib/", + "languageVersion": "2.4" + }, + { + "name": "http_parser", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.4", + "packageUri": "lib/", + "languageVersion": "2.3" + }, + { + "name": "meta", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/meta-1.1.8", + "packageUri": "lib/", + "languageVersion": "1.12" + }, + { + "name": "path", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/path-1.6.4", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "source_span", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/source_span-1.7.0", + "packageUri": "lib/", + "languageVersion": "2.6" + }, + { + "name": "string_scanner", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "term_glyph", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0", + "packageUri": "lib/", + "languageVersion": "1.8" + }, + { + "name": "typed_data", + "rootUri": "file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "appwrite", + "rootUri": "../", + "packageUri": "lib/", + "languageVersion": "2.6" + } + ], + "generated": "2020-04-10T18:56:11.631386Z", + "generator": "pub", + "generatorVersion": "2.7.2" +} diff --git a/app/sdks/flutter-dart/.packages b/app/sdks/flutter-dart/.packages new file mode 100644 index 0000000000..7b07f11699 --- /dev/null +++ b/app/sdks/flutter-dart/.packages @@ -0,0 +1,14 @@ +# Generated by pub on 2020-04-10 21:56:11.618646. +charcode:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.3/lib/ +collection:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/collection-1.14.12/lib/ +cookie_jar:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/cookie_jar-1.0.1/lib/ +dio:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/dio-3.0.9/lib/ +dio_cookie_manager:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/dio_cookie_manager-1.0.0/lib/ +http_parser:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.4/lib/ +meta:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/meta-1.1.8/lib/ +path:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/path-1.6.4/lib/ +source_span:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/source_span-1.7.0/lib/ +string_scanner:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5/lib/ +term_glyph:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/ +typed_data:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/ +appwrite:lib/ diff --git a/app/sdks/flutter-dart/pubspec.lock b/app/sdks/flutter-dart/pubspec.lock new file mode 100644 index 0000000000..a1648b1374 --- /dev/null +++ b/app/sdks/flutter-dart/pubspec.lock @@ -0,0 +1,89 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.3" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.12" + cookie_jar: + dependency: "direct main" + description: + name: cookie_jar + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + dio: + dependency: "direct main" + description: + name: dio + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.9" + dio_cookie_manager: + dependency: "direct main" + description: + name: dio_cookie_manager + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.4" + meta: + dependency: "direct main" + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.8" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.4" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" +sdks: + dart: ">=2.6.0 <3.0.0"