From 573e15305704cb7b74f4ebf0d7036512f9148ec5 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 14 Apr 2020 17:13:19 +0300 Subject: [PATCH] Updated SDKs --- .../examples/storage/get-file-download.md | 8 +-- .../docs/examples/storage/get-file-preview.md | 8 +-- .../docs/examples/storage/get-file-view.md | 8 +-- app/sdks/console-javascript/src/sdk.js | 50 ++++++++++++------- app/sdks/console-javascript/src/sdk.min.js | 8 +-- .../docs/examples/storage/create-file.md | 1 + .../examples/storage/get-file-download.md | 9 +--- .../docs/examples/storage/get-file-preview.md | 9 +--- .../docs/examples/storage/get-file-view.md | 9 +--- .../flutter-dart/lib/services/account.dart | 24 +++++++-- .../flutter-dart/lib/services/storage.dart | 45 +++++++++++------ app/sdks/flutter-dart/pubspec.yaml | 4 +- .../examples/storage/get-file-download.md | 8 +-- .../docs/examples/storage/get-file-preview.md | 8 +-- .../docs/examples/storage/get-file-view.md | 8 +-- app/sdks/web-javascript/src/sdk.js | 42 +++++++++------- app/sdks/web-javascript/src/sdk.min.js | 8 +-- composer.lock | 4 +- 18 files changed, 134 insertions(+), 127 deletions(-) diff --git a/app/sdks/console-javascript/docs/examples/storage/get-file-download.md b/app/sdks/console-javascript/docs/examples/storage/get-file-download.md index d1595f50bb..0d0ff8fc3e 100644 --- a/app/sdks/console-javascript/docs/examples/storage/get-file-download.md +++ b/app/sdks/console-javascript/docs/examples/storage/get-file-download.md @@ -5,10 +5,6 @@ sdk .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; -let promise = sdk.storage.getFileDownload('[FILE_ID]'); +let result = sdk.storage.getFileDownload('[FILE_ID]'); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(result); // Resource URL diff --git a/app/sdks/console-javascript/docs/examples/storage/get-file-preview.md b/app/sdks/console-javascript/docs/examples/storage/get-file-preview.md index 0341011dc9..712b38917a 100644 --- a/app/sdks/console-javascript/docs/examples/storage/get-file-preview.md +++ b/app/sdks/console-javascript/docs/examples/storage/get-file-preview.md @@ -5,10 +5,6 @@ sdk .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; -let promise = sdk.storage.getFilePreview('[FILE_ID]'); +let result = sdk.storage.getFilePreview('[FILE_ID]'); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(result); // Resource URL diff --git a/app/sdks/console-javascript/docs/examples/storage/get-file-view.md b/app/sdks/console-javascript/docs/examples/storage/get-file-view.md index 6754e9ce24..08368f8b19 100644 --- a/app/sdks/console-javascript/docs/examples/storage/get-file-view.md +++ b/app/sdks/console-javascript/docs/examples/storage/get-file-view.md @@ -5,10 +5,6 @@ sdk .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; -let promise = sdk.storage.getFileView('[FILE_ID]'); +let result = sdk.storage.getFileView('[FILE_ID]'); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(result); // Resource URL diff --git a/app/sdks/console-javascript/src/sdk.js b/app/sdks/console-javascript/src/sdk.js index 7b0474630d..e037406e41 100644 --- a/app/sdks/console-javascript/src/sdk.js +++ b/app/sdks/console-javascript/src/sdk.js @@ -765,10 +765,13 @@ payload['failure'] = failure; } - return http - .get(path, { - 'content-type': 'application/json', - }, payload); + payload['project'] = config.project; + + payload['key'] = config.key; + + let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&'); + + window.location = config.endpoint + path + ((query) ? '?' + query : ''); }, /** @@ -3182,7 +3185,7 @@ * * @param {string} fileId * @throws {Error} - * @return {Promise} + * @return {string} */ getFileDownload: function(fileId) { if(fileId === undefined) { @@ -3193,10 +3196,13 @@ let payload = {}; - return http - .get(path, { - 'content-type': 'application/json', - }, payload); + payload['project'] = config.project; + + payload['key'] = config.key; + + let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&'); + + return config.endpoint + path + ((query) ? '?' + query : ''); }, /** @@ -3214,7 +3220,7 @@ * @param {string} background * @param {string} output * @throws {Error} - * @return {Promise} + * @return {string} */ getFilePreview: function(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { if(fileId === undefined) { @@ -3245,10 +3251,13 @@ payload['output'] = output; } - return http - .get(path, { - 'content-type': 'application/json', - }, payload); + payload['project'] = config.project; + + payload['key'] = config.key; + + let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&'); + + return config.endpoint + path + ((query) ? '?' + query : ''); }, /** @@ -3260,7 +3269,7 @@ * @param {string} fileId * @param {string} as * @throws {Error} - * @return {Promise} + * @return {string} */ getFileView: function(fileId, as = '') { if(fileId === undefined) { @@ -3275,10 +3284,13 @@ payload['as'] = as; } - return http - .get(path, { - 'content-type': 'application/json', - }, payload); + payload['project'] = config.project; + + payload['key'] = config.key; + + let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&'); + + return config.endpoint + path + ((query) ? '?' + query : ''); } }; diff --git a/app/sdks/console-javascript/src/sdk.min.js b/app/sdks/console-javascript/src/sdk.min.js index 8032976ba3..d24b9d9fe1 100644 --- a/app/sdks/console-javascript/src/sdk.min.js +++ b/app/sdks/console-javascript/src/sdk.min.js @@ -48,7 +48,7 @@ if(password){payload.password=password} return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://localhost:2444/auth/oauth2/success',failure='https://localhost:2444/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success} if(failure){payload.failure=failure} -return http.get(path,{'content-type':'application/json',},payload)},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')} +payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')} let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')} let path='/account/verification';let payload={};if(url){payload.url=url} return http.post(path,{'content-type':'application/json',},payload)},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} @@ -297,15 +297,15 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le if(write){payload.write=write} return http.put(path,{'content-type':'application/json',},payload)},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} -let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload.width=width} if(height){payload.height=height} if(quality){payload.quality=quality} if(background){payload.background=background} if(output){payload.output=output} -return http.get(path,{'content-type':'application/json',},payload)},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload.as=as} -return http.get(path,{'content-type':'application/json',},payload)}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search} +payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search} if(limit){payload.limit=limit} if(offset){payload.offset=offset} if(orderType){payload.orderType=orderType} diff --git a/app/sdks/flutter-dart/docs/examples/storage/create-file.md b/app/sdks/flutter-dart/docs/examples/storage/create-file.md index 25db3f3a5a..b7ee0857ae 100644 --- a/app/sdks/flutter-dart/docs/examples/storage/create-file.md +++ b/app/sdks/flutter-dart/docs/examples/storage/create-file.md @@ -1,3 +1,4 @@ +import 'dart:io'; import 'package:appwrite/appwrite.dart'; // Init SDK diff --git a/app/sdks/flutter-dart/docs/examples/storage/get-file-download.md b/app/sdks/flutter-dart/docs/examples/storage/get-file-download.md index 77b78a757b..e00cdc9022 100644 --- a/app/sdks/flutter-dart/docs/examples/storage/get-file-download.md +++ b/app/sdks/flutter-dart/docs/examples/storage/get-file-download.md @@ -8,13 +8,8 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -Future result = storage.getFileDownload( +String result = storage.getFileDownload( fileId: '[FILE_ID]', ); -result - .then((response) { - print(response); - }).catchError((error) { - print(error); - }); \ No newline at end of file +print(result); // Resource URL string diff --git a/app/sdks/flutter-dart/docs/examples/storage/get-file-preview.md b/app/sdks/flutter-dart/docs/examples/storage/get-file-preview.md index 85e24d7d9a..5297ab8342 100644 --- a/app/sdks/flutter-dart/docs/examples/storage/get-file-preview.md +++ b/app/sdks/flutter-dart/docs/examples/storage/get-file-preview.md @@ -8,13 +8,8 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -Future result = storage.getFilePreview( +String result = storage.getFilePreview( fileId: '[FILE_ID]', ); -result - .then((response) { - print(response); - }).catchError((error) { - print(error); - }); \ No newline at end of file +print(result); // Resource URL string diff --git a/app/sdks/flutter-dart/docs/examples/storage/get-file-view.md b/app/sdks/flutter-dart/docs/examples/storage/get-file-view.md index 985b73839d..13b1de4822 100644 --- a/app/sdks/flutter-dart/docs/examples/storage/get-file-view.md +++ b/app/sdks/flutter-dart/docs/examples/storage/get-file-view.md @@ -8,13 +8,8 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -Future result = storage.getFileView( +String result = storage.getFileView( fileId: '[FILE_ID]', ); -result - .then((response) { - print(response); - }).catchError((error) { - print(error); - }); \ No newline at end of file +print(result); // Resource URL string diff --git a/app/sdks/flutter-dart/lib/services/account.dart b/app/sdks/flutter-dart/lib/services/account.dart index d1abc9147d..ea87290a8e 100644 --- a/app/sdks/flutter-dart/lib/services/account.dart +++ b/app/sdks/flutter-dart/lib/services/account.dart @@ -1,7 +1,9 @@ +import 'dart:io'; import 'package:dio/dio.dart'; import 'package:meta/meta.dart'; +import 'package:flutter_web_auth/flutter_web_auth.dart'; import "../client.dart"; import '../enums.dart'; @@ -303,19 +305,31 @@ class Account extends Service { /// first. Use the success and failure arguments to provide a redirect URL's /// back to your app when login is completed. /// - Future createOAuth2Session({@required String provider, String success = 'https://localhost:2444/auth/oauth2/success', String failure = 'https://localhost:2444/auth/oauth2/failure'}) { + Future createOAuth2Session({@required String provider, String success = 'https://localhost:2444/auth/oauth2/success', String failure = 'https://localhost:2444/auth/oauth2/failure'}) { final String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider); final Map params = { 'success': success, 'failure': failure, + 'project': client.config['project'], }; - final Map headers = { - 'content-type': 'application/json', - }; + Uri endpoint = Uri.parse(client.endPoint); + Uri url = new Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + queryParameters:params, + ); - return client.call(HttpMethod.get, path: path, params: params, headers: headers); + return FlutterWebAuth.authenticate( + url: url.toString(), + callbackUrlScheme: "appwrite-callback" + ).then((value) { + Uri url = Uri.parse(value); + List cookies = [new Cookie(url.queryParameters['key'], url.queryParameters['secret'])]; + client.cookieJar.saveFromResponse(Uri.parse(client.endPoint), cookies); + }); } /// Delete Account Session diff --git a/app/sdks/flutter-dart/lib/services/storage.dart b/app/sdks/flutter-dart/lib/services/storage.dart index ae4ab7e1a1..47497c7699 100644 --- a/app/sdks/flutter-dart/lib/services/storage.dart +++ b/app/sdks/flutter-dart/lib/services/storage.dart @@ -117,17 +117,22 @@ class Storage extends Service { /// 'Content-Disposition: attachment' header that tells the browser to start /// downloading the file to user downloads directory. /// - Future getFileDownload({@required String fileId}) { + String getFileDownload({@required String fileId}) { final String path = '/storage/files/{fileId}/download'.replaceAll(RegExp('{fileId}'), fileId); final Map params = { + 'project': client.config['project'], }; - final Map headers = { - 'content-type': 'application/json', - }; + Uri endpoint = Uri.parse(client.endPoint); + Uri url = new Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + queryParameters:params, + ); - return client.call(HttpMethod.get, path: path, params: params, headers: headers); + return url.toString(); } /// Get File Preview @@ -137,7 +142,7 @@ class Storage extends Service { /// and spreadsheets, will return the file icon image. You can also pass query /// string arguments for cutting and resizing your preview image. /// - Future getFilePreview({@required String fileId, int width = 0, int height = 0, int quality = 100, String background = '', String output = ''}) { + String getFilePreview({@required String fileId, int width = 0, int height = 0, int quality = 100, String background = '', String output = ''}) { final String path = '/storage/files/{fileId}/preview'.replaceAll(RegExp('{fileId}'), fileId); final Map params = { @@ -146,13 +151,18 @@ class Storage extends Service { 'quality': quality, 'background': background, 'output': output, + 'project': client.config['project'], }; - final Map headers = { - 'content-type': 'application/json', - }; + Uri endpoint = Uri.parse(client.endPoint); + Uri url = new Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + queryParameters:params, + ); - return client.call(HttpMethod.get, path: path, params: params, headers: headers); + return url.toString(); } /// Get File for View @@ -160,17 +170,22 @@ class Storage extends Service { /// Get file content by its unique ID. This endpoint is similar to the download /// method but returns with no 'Content-Disposition: attachment' header. /// - Future getFileView({@required String fileId, String as = ''}) { + String getFileView({@required String fileId, String as = ''}) { final String path = '/storage/files/{fileId}/view'.replaceAll(RegExp('{fileId}'), fileId); final Map params = { 'as': as, + 'project': client.config['project'], }; - final Map headers = { - 'content-type': 'application/json', - }; + Uri endpoint = Uri.parse(client.endPoint); + Uri url = new Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + queryParameters:params, + ); - return client.call(HttpMethod.get, path: path, params: params, headers: headers); + return url.toString(); } } \ No newline at end of file diff --git a/app/sdks/flutter-dart/pubspec.yaml b/app/sdks/flutter-dart/pubspec.yaml index 6393725d73..340baaf637 100644 --- a/app/sdks/flutter-dart/pubspec.yaml +++ b/app/sdks/flutter-dart/pubspec.yaml @@ -1,6 +1,6 @@ name: appwrite version: 0.1.0 -description: 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 +description: Appwrite is an open-source self-hosted backend as a service that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-dart issue_tracker: https://github.com/appwrite/sdk-generator/issues @@ -14,7 +14,7 @@ dependencies: dio: ^3.0.0 cookie_jar: ^1.0.0 dio_cookie_manager: ^1.0.0 - flutter_web_auth: ^0.1.3 + flutter_web_auth: ^0.2.0 flutter: sdk: flutter diff --git a/app/sdks/web-javascript/docs/examples/storage/get-file-download.md b/app/sdks/web-javascript/docs/examples/storage/get-file-download.md index c3ec2b0b84..817388b206 100644 --- a/app/sdks/web-javascript/docs/examples/storage/get-file-download.md +++ b/app/sdks/web-javascript/docs/examples/storage/get-file-download.md @@ -4,10 +4,6 @@ sdk .setProject('5df5acd0d48c2') // Your project ID ; -let promise = sdk.storage.getFileDownload('[FILE_ID]'); +let result = sdk.storage.getFileDownload('[FILE_ID]'); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(result); // Resource URL diff --git a/app/sdks/web-javascript/docs/examples/storage/get-file-preview.md b/app/sdks/web-javascript/docs/examples/storage/get-file-preview.md index cc2d628cbc..81fd86c4fc 100644 --- a/app/sdks/web-javascript/docs/examples/storage/get-file-preview.md +++ b/app/sdks/web-javascript/docs/examples/storage/get-file-preview.md @@ -4,10 +4,6 @@ sdk .setProject('5df5acd0d48c2') // Your project ID ; -let promise = sdk.storage.getFilePreview('[FILE_ID]'); +let result = sdk.storage.getFilePreview('[FILE_ID]'); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(result); // Resource URL diff --git a/app/sdks/web-javascript/docs/examples/storage/get-file-view.md b/app/sdks/web-javascript/docs/examples/storage/get-file-view.md index 4150e7b11d..c9bd9c3c69 100644 --- a/app/sdks/web-javascript/docs/examples/storage/get-file-view.md +++ b/app/sdks/web-javascript/docs/examples/storage/get-file-view.md @@ -4,10 +4,6 @@ sdk .setProject('5df5acd0d48c2') // Your project ID ; -let promise = sdk.storage.getFileView('[FILE_ID]'); +let result = sdk.storage.getFileView('[FILE_ID]'); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(result); // Resource URL diff --git a/app/sdks/web-javascript/src/sdk.js b/app/sdks/web-javascript/src/sdk.js index a5b70a1d99..5b3d3e55a3 100644 --- a/app/sdks/web-javascript/src/sdk.js +++ b/app/sdks/web-javascript/src/sdk.js @@ -765,10 +765,11 @@ payload['failure'] = failure; } - return http - .get(path, { - 'content-type': 'application/json', - }, payload); + payload['project'] = config.project; + + let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&'); + + window.location = config.endpoint + path + ((query) ? '?' + query : ''); }, /** @@ -1698,7 +1699,7 @@ * * @param {string} fileId * @throws {Error} - * @return {Promise} + * @return {string} */ getFileDownload: function(fileId) { if(fileId === undefined) { @@ -1709,10 +1710,11 @@ let payload = {}; - return http - .get(path, { - 'content-type': 'application/json', - }, payload); + payload['project'] = config.project; + + let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&'); + + return config.endpoint + path + ((query) ? '?' + query : ''); }, /** @@ -1730,7 +1732,7 @@ * @param {string} background * @param {string} output * @throws {Error} - * @return {Promise} + * @return {string} */ getFilePreview: function(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { if(fileId === undefined) { @@ -1761,10 +1763,11 @@ payload['output'] = output; } - return http - .get(path, { - 'content-type': 'application/json', - }, payload); + payload['project'] = config.project; + + let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&'); + + return config.endpoint + path + ((query) ? '?' + query : ''); }, /** @@ -1776,7 +1779,7 @@ * @param {string} fileId * @param {string} as * @throws {Error} - * @return {Promise} + * @return {string} */ getFileView: function(fileId, as = '') { if(fileId === undefined) { @@ -1791,10 +1794,11 @@ payload['as'] = as; } - return http - .get(path, { - 'content-type': 'application/json', - }, payload); + payload['project'] = config.project; + + let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&'); + + return config.endpoint + path + ((query) ? '?' + query : ''); } }; diff --git a/app/sdks/web-javascript/src/sdk.min.js b/app/sdks/web-javascript/src/sdk.min.js index 6be1c95017..29204764d1 100644 --- a/app/sdks/web-javascript/src/sdk.min.js +++ b/app/sdks/web-javascript/src/sdk.min.js @@ -48,7 +48,7 @@ if(password){payload.password=password} return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://localhost:2444/auth/oauth2/success',failure='https://localhost:2444/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success} if(failure){payload.failure=failure} -return http.get(path,{'content-type':'application/json',},payload)},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')} +payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')} let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')} let path='/account/verification';let payload={};if(url){payload.url=url} return http.post(path,{'content-type':'application/json',},payload)},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} @@ -128,15 +128,15 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le if(write){payload.write=write} return http.put(path,{'content-type':'application/json',},payload)},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} -let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload.width=width} if(height){payload.height=height} if(quality){payload.quality=quality} if(background){payload.background=background} if(output){payload.output=output} -return http.get(path,{'content-type':'application/json',},payload)},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload.as=as} -return http.get(path,{'content-type':'application/json',},payload)}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search} +payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search} if(limit){payload.limit=limit} if(offset){payload.offset=offset} if(orderType){payload.orderType=orderType} diff --git a/composer.lock b/composer.lock index 1af78077be..a83bab426f 100644 --- a/composer.lock +++ b/composer.lock @@ -1622,7 +1622,7 @@ "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "8fd05f838db79fb253875cfa68b31f48876acc85" + "reference": "ccab743c1a82aa116456114a66dfefe1976e125a" }, "require": { "ext-curl": "*", @@ -1652,7 +1652,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2020-04-12T10:47:23+00:00" + "time": "2020-04-14T14:07:24+00:00" }, { "name": "doctrine/instantiator",