diff --git a/app/sdks/console-javascript/README.md b/app/sdks/console-javascript/README.md index 005e2d2364..2c46552b04 100644 --- a/app/sdks/console-javascript/README.md +++ b/app/sdks/console-javascript/README.md @@ -1,7 +1,7 @@ # Appwrite SDK for JavaScript ![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.5.0-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -33,6 +33,10 @@ To install with a CDN (content delivery network) add the following scripts to th +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + ## License Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/flutter-dart/README.md b/app/sdks/flutter-dart/README.md index 3c454c8317..f51e3e5f95 100644 --- a/app/sdks/flutter-dart/README.md +++ b/app/sdks/flutter-dart/README.md @@ -1,7 +1,7 @@ # Appwrite SDK for Dart ![License](https://img.shields.io/github/license/appwrite/sdk-for-dart.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.5.0-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) **This SDK is compatible with Appwrite server version . For older versions, please check previous releases.** @@ -26,6 +26,10 @@ You can install packages from the command line: pub get ``` +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + ## License Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/flutter-dart/lib/client.dart b/app/sdks/flutter-dart/lib/client.dart index c4b19692c6..c5fb760362 100644 --- a/app/sdks/flutter-dart/lib/client.dart +++ b/app/sdks/flutter-dart/lib/client.dart @@ -2,6 +2,8 @@ import 'package:dio/dio.dart'; import 'package:dio_cookie_manager/dio_cookie_manager.dart'; import 'package:cookie_jar/cookie_jar.dart'; +import 'enums.dart'; + class Client { String endPoint; Map headers; @@ -71,18 +73,18 @@ class Client { return this; } - Future call(String method, {String path = '', Map headers = const {}, Map params = const {}}) { + Future call(HttpMethod method, {String path = '', Map headers = const {}, Map params = const {}}) { if(this.selfSigned) { // Allow self signed requests } String reqPath = path; - bool isGet = method.toUpperCase() == "GET"; + bool isGet = method == HttpMethod.get; // Origin is hardcoded for testing Options options = Options( headers: {...this.headers, ...headers, "Origin": "http://localhost"}, - method: method.toUpperCase(), + method: method.name(), ); if (isGet) { diff --git a/app/sdks/flutter-dart/lib/enums.dart b/app/sdks/flutter-dart/lib/enums.dart new file mode 100644 index 0000000000..69b7ba44e8 --- /dev/null +++ b/app/sdks/flutter-dart/lib/enums.dart @@ -0,0 +1,9 @@ +enum HttpMethod { + get, post, put, delete, patch +} + +extension HttpMethodString on HttpMethod{ + String name(){ + return this.toString().split('.').last.toUpperCase(); + } +} diff --git a/app/sdks/flutter-dart/lib/services/account.dart b/app/sdks/flutter-dart/lib/services/account.dart index 99ec446080..3e873ab951 100644 --- a/app/sdks/flutter-dart/lib/services/account.dart +++ b/app/sdks/flutter-dart/lib/services/account.dart @@ -1,6 +1,11 @@ +import 'dart:html'; + import "package:appwrite/service.dart"; import "package:appwrite/client.dart"; import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import '../enums.dart'; class Account extends Service { @@ -13,7 +18,7 @@ class Account extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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 @@ -21,7 +26,7 @@ class Account extends Service { /// 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/account#createSession). - Future create({email, password, name = null}) async { + Future create({@required String email, @required String password, String name = null}) async { String path = '/account'; Map params = { @@ -30,7 +35,7 @@ class Account extends Service { 'name': name, }; - return await this.client.call('post', path: path, params: params); + return await this.client.call(HttpMethod.post, path: path, params: params); } /// 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 @@ -43,13 +48,13 @@ class Account extends Service { Map params = { }; - return await this.client.call('delete', path: path, params: params); + return await this.client.call(HttpMethod.delete, path: path, params: params); } /// 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. - Future updateEmail({email, password}) async { + Future updateEmail({@required String email, @required String password}) async { String path = '/account/email'; Map params = { @@ -57,7 +62,7 @@ class Account extends Service { 'password': password, }; - return await this.client.call('patch', path: path, params: params); + return await this.client.call(HttpMethod.patch, path: path, params: params); } /// Get currently logged in user list of latest security activity logs. Each /// log returns user IP address, location and date and time of log. @@ -67,21 +72,21 @@ class Account extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// Update currently logged in user account name. - Future updateName({name}) async { + Future updateName({@required String name}) async { String path = '/account/name'; Map params = { 'name': name, }; - return await this.client.call('patch', path: path, params: params); + return await this.client.call(HttpMethod.patch, path: path, params: params); } /// Update currently logged in user password. For validation, user is required /// to pass the password twice. - Future updatePassword({password, oldPassword}) async { + Future updatePassword({@required String password, @required String oldPassword}) async { String path = '/account/password'; Map params = { @@ -89,7 +94,7 @@ class Account extends Service { 'old-password': oldPassword, }; - return await this.client.call('patch', path: path, params: params); + return await this.client.call(HttpMethod.patch, path: path, params: params); } /// Get currently logged in user preferences as a key-value object. Future getPrefs() async { @@ -98,18 +103,18 @@ class Account extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// Update currently logged in user account preferences. You can pass only the /// specific settings you wish to update. - Future updatePrefs({prefs}) async { + Future updatePrefs({@required dynamic prefs}) async { String path = '/account/prefs'; Map params = { 'prefs': prefs, }; - return await this.client.call('patch', path: path, params: params); + return await this.client.call(HttpMethod.patch, path: path, params: params); } /// 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 @@ -117,7 +122,7 @@ class Account extends Service { /// attached to the URL query string. Use the query string params to submit a /// request to the [PUT /account/recovery](/docs/account#updateRecovery) /// endpoint to complete the process. - Future createRecovery({email, url}) async { + Future createRecovery({@required String email, @required String url}) async { String path = '/account/recovery'; Map params = { @@ -125,7 +130,7 @@ class Account extends Service { 'url': url, }; - return await this.client.call('post', path: path, params: params); + return await this.client.call(HttpMethod.post, path: path, params: params); } /// Use this endpoint to complete the user account password reset. Both the /// **userId** and **secret** arguments will be passed as query parameters to @@ -136,7 +141,7 @@ class Account extends Service { /// 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. - Future updateRecovery({userId, secret, passwordA, passwordB}) async { + Future updateRecovery({@required String userId, @required String secret, @required String passwordA, @required String passwordB}) async { String path = '/account/recovery'; Map params = { @@ -146,7 +151,7 @@ class Account extends Service { 'password-b': passwordB, }; - return await this.client.call('put', path: path, params: params); + return await this.client.call(HttpMethod.put, path: path, params: params); } /// Get currently logged in user list of active sessions across different /// devices. @@ -156,11 +161,11 @@ class Account extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. - Future createSession({email, password}) async { + Future createSession({@required String email, @required String password}) async { String path = '/account/sessions'; Map params = { @@ -168,7 +173,7 @@ class Account extends Service { 'password': password, }; - return await this.client.call('post', path: path, params: params); + return await this.client.call(HttpMethod.post, path: path, params: params); } /// Delete all sessions from the user account and remove any sessions cookies /// from the end client. @@ -178,13 +183,13 @@ class Account extends Service { Map params = { }; - return await this.client.call('delete', path: path, params: params); + return await this.client.call(HttpMethod.delete, path: path, params: params); } /// 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. - Future createOAuth2Session({provider, success, failure}) async { + Future createOAuth2Session({@required String provider, @required String success, @required String failure}) async { String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider); Map params = { @@ -192,18 +197,18 @@ class Account extends Service { 'failure': failure, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. - Future deleteSession({sessionId}) async { + Future deleteSession({@required String sessionId}) async { String path = '/account/sessions/{sessionId}'.replaceAll(RegExp('{sessionId}'), sessionId); Map params = { }; - return await this.client.call('delete', path: path, params: params); + return await this.client.call(HttpMethod.delete, path: path, params: params); } /// 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** @@ -218,20 +223,20 @@ class Account extends Service { /// 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. - Future createVerification({url}) async { + Future createVerification({@required String url}) async { String path = '/account/verification'; Map params = { 'url': url, }; - return await this.client.call('post', path: path, params: params); + return await this.client.call(HttpMethod.post, path: path, params: params); } /// 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. - Future updateVerification({userId, secret}) async { + Future updateVerification({@required String userId, @required String secret}) async { String path = '/account/verification'; Map params = { @@ -239,6 +244,6 @@ class Account extends Service { 'secret': secret, }; - return await this.client.call('put', path: path, params: params); + return await this.client.call(HttpMethod.put, path: path, params: params); } } \ No newline at end of file diff --git a/app/sdks/flutter-dart/lib/services/avatars.dart b/app/sdks/flutter-dart/lib/services/avatars.dart index 4ffcc6aa15..234c1f5ad9 100644 --- a/app/sdks/flutter-dart/lib/services/avatars.dart +++ b/app/sdks/flutter-dart/lib/services/avatars.dart @@ -1,6 +1,11 @@ +import 'dart:html'; + import "package:appwrite/service.dart"; import "package:appwrite/client.dart"; import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import '../enums.dart'; class Avatars extends Service { @@ -10,7 +15,7 @@ class Avatars extends Service { /// 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. - Future getBrowser({code, width = 100, height = 100, quality = 100}) async { + Future getBrowser({@required String code, int width = 100, int height = 100, int quality = 100}) async { String path = '/avatars/browsers/{code}'.replaceAll(RegExp('{code}'), code); Map params = { @@ -19,13 +24,13 @@ class Avatars extends Service { 'quality': quality, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. - Future getCreditCard({code, width = 100, height = 100, quality = 100}) async { + Future getCreditCard({@required String code, int width = 100, int height = 100, int quality = 100}) async { String path = '/avatars/credit-cards/{code}'.replaceAll(RegExp('{code}'), code); Map params = { @@ -34,23 +39,23 @@ class Avatars extends Service { 'quality': quality, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote /// website URL. - Future getFavicon({url}) async { + Future getFavicon({@required String url}) async { String path = '/avatars/favicon'; Map params = { 'url': url, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. - Future getFlag({code, width = 100, height = 100, quality = 100}) async { + Future getFlag({@required String code, int width = 100, int height = 100, int quality = 100}) async { String path = '/avatars/flags/{code}'.replaceAll(RegExp('{code}'), code); Map params = { @@ -59,13 +64,13 @@ class Avatars extends Service { 'quality': quality, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. - Future getImage({url, width = 400, height = 400}) async { + Future getImage({@required String url, int width = 400, int height = 400}) async { String path = '/avatars/image'; Map params = { @@ -74,11 +79,11 @@ class Avatars extends Service { 'height': height, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. - Future getQR({text, size = 400, margin = 1, download = null}) async { + Future getQR({@required String text, int size = 400, int margin = 1, int download = null}) async { String path = '/avatars/qr'; Map params = { @@ -88,6 +93,6 @@ class Avatars extends Service { 'download': download, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } } \ No newline at end of file diff --git a/app/sdks/flutter-dart/lib/services/database.dart b/app/sdks/flutter-dart/lib/services/database.dart index ca6f9fa93c..1ca005bdf5 100644 --- a/app/sdks/flutter-dart/lib/services/database.dart +++ b/app/sdks/flutter-dart/lib/services/database.dart @@ -1,6 +1,11 @@ +import 'dart:html'; + import "package:appwrite/service.dart"; import "package:appwrite/client.dart"; import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import '../enums.dart'; class Database extends Service { @@ -10,7 +15,7 @@ class Database extends Service { /// 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). - Future listDocuments({collectionId, filters = const [], offset = null, limit = 50, orderField = '\$id', orderType = 'ASC', orderCast = 'string', search = null, first = null, last = null}) async { + Future listDocuments({@required String collectionId, List filters = const [], int offset = null, int limit = 50, String orderField = '\$id', String orderType = 'ASC', String orderCast = 'string', String search = null, int first = null, int last = null}) async { String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); Map params = { @@ -25,10 +30,10 @@ class Database extends Service { 'last': last, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// Create a new Document. - Future createDocument({collectionId, data, read, write, parentDocument = null, parentProperty = null, parentPropertyType = 'assign'}) async { + Future createDocument({@required String collectionId, @required dynamic data, @required List read, @required List write, String parentDocument = null, String parentProperty = null, String parentPropertyType = 'assign'}) async { String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); Map params = { @@ -40,19 +45,19 @@ class Database extends Service { 'parentPropertyType': parentPropertyType, }; - return await this.client.call('post', path: path, params: params); + return await this.client.call(HttpMethod.post, path: path, params: params); } /// Get document by its unique ID. This endpoint response returns a JSON object /// with the document data. - Future getDocument({collectionId, documentId}) async { + Future getDocument({@required String collectionId, @required String documentId}) async { String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } - Future updateDocument({collectionId, documentId, data, read, write}) async { + Future updateDocument({@required String collectionId, @required String documentId, @required dynamic data, @required List read, @required List write}) async { String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); Map params = { @@ -61,17 +66,17 @@ class Database extends Service { 'write': write, }; - return await this.client.call('patch', path: path, params: params); + return await this.client.call(HttpMethod.patch, path: path, params: params); } /// 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. - Future deleteDocument({collectionId, documentId}) async { + Future deleteDocument({@required String collectionId, @required String documentId}) async { String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); Map params = { }; - return await this.client.call('delete', path: path, params: params); + return await this.client.call(HttpMethod.delete, path: path, params: params); } } \ No newline at end of file diff --git a/app/sdks/flutter-dart/lib/services/locale.dart b/app/sdks/flutter-dart/lib/services/locale.dart index 208c72bd08..fc10792133 100644 --- a/app/sdks/flutter-dart/lib/services/locale.dart +++ b/app/sdks/flutter-dart/lib/services/locale.dart @@ -1,6 +1,11 @@ +import 'dart:html'; + import "package:appwrite/service.dart"; import "package:appwrite/client.dart"; import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import '../enums.dart'; class Locale extends Service { @@ -18,7 +23,7 @@ class Locale extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// List of all continents. You can use the locale header to get the data in a /// supported language. @@ -28,7 +33,7 @@ class Locale extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// List of all countries. You can use the locale header to get the data in a /// supported language. @@ -38,7 +43,7 @@ class Locale extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. @@ -48,7 +53,7 @@ class Locale extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// List of all countries phone codes. You can use the locale header to get the /// data in a supported language. @@ -58,7 +63,7 @@ class Locale extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// List of all currencies, including currency symol, name, plural, and decimal /// digits for all major and minor currencies. You can use the locale header to @@ -69,6 +74,6 @@ class Locale extends Service { Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } } \ No newline at end of file diff --git a/app/sdks/flutter-dart/lib/services/storage.dart b/app/sdks/flutter-dart/lib/services/storage.dart index da71e7cad4..b4484f2a41 100644 --- a/app/sdks/flutter-dart/lib/services/storage.dart +++ b/app/sdks/flutter-dart/lib/services/storage.dart @@ -1,6 +1,11 @@ +import 'dart:html'; + import "package:appwrite/service.dart"; import "package:appwrite/client.dart"; import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import '../enums.dart'; class Storage extends Service { @@ -9,7 +14,7 @@ class Storage extends Service { /// 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). - Future listFiles({search = null, limit = 25, offset = null, orderType = 'ASC'}) async { + Future listFiles({String search = null, int limit = 25, int offset = null, String orderType = 'ASC'}) async { String path = '/storage/files'; Map params = { @@ -19,12 +24,12 @@ class Storage extends Service { 'orderType': orderType, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. - Future createFile({file, read, write}) async { + Future createFile({@required File file, @required List read, @required List write}) async { String path = '/storage/files'; Map params = { @@ -33,21 +38,21 @@ class Storage extends Service { 'write': write, }; - return await this.client.call('post', path: path, params: params); + return await this.client.call(HttpMethod.post, path: path, params: params); } /// Get file by its unique ID. This endpoint response returns a JSON object /// with the file metadata. - Future getFile({fileId}) async { + Future getFile({@required String fileId}) async { String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// Update file by its unique ID. Only users with write permissions have access /// to update this resource. - Future updateFile({fileId, read, write}) async { + Future updateFile({@required String fileId, @required List read, @required List write}) async { String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); Map params = { @@ -55,34 +60,34 @@ class Storage extends Service { 'write': write, }; - return await this.client.call('put', path: path, params: params); + return await this.client.call(HttpMethod.put, path: path, params: params); } /// Delete a file by its unique ID. Only users with write permissions have /// access to delete this resource. - Future deleteFile({fileId}) async { + Future deleteFile({@required String fileId}) async { String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); Map params = { }; - return await this.client.call('delete', path: path, params: params); + return await this.client.call(HttpMethod.delete, path: path, params: params); } /// 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. - Future getFileDownload({fileId}) async { + Future getFileDownload({@required String fileId}) async { String path = '/storage/files/{fileId}/download'.replaceAll(RegExp('{fileId}'), fileId); Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. - Future getFilePreview({fileId, width = null, height = null, quality = 100, background = null, output = null}) async { + Future getFilePreview({@required String fileId, int width = null, int height = null, int quality = 100, String background = null, String output = null}) async { String path = '/storage/files/{fileId}/preview'.replaceAll(RegExp('{fileId}'), fileId); Map params = { @@ -93,17 +98,17 @@ class Storage extends Service { 'output': output, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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({fileId, as = null}) async { + Future getFileView({@required String fileId, String as = null}) async { String path = '/storage/files/{fileId}/view'.replaceAll(RegExp('{fileId}'), fileId); Map params = { 'as': as, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } } \ No newline at end of file diff --git a/app/sdks/flutter-dart/lib/services/teams.dart b/app/sdks/flutter-dart/lib/services/teams.dart index fb5ce16c00..ca3f6ad11d 100644 --- a/app/sdks/flutter-dart/lib/services/teams.dart +++ b/app/sdks/flutter-dart/lib/services/teams.dart @@ -1,6 +1,11 @@ +import 'dart:html'; + import "package:appwrite/service.dart"; import "package:appwrite/client.dart"; import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import '../enums.dart'; class Teams extends Service { @@ -9,7 +14,7 @@ class Teams extends Service { /// 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). - Future list({search = null, limit = 25, offset = null, orderType = 'ASC'}) async { + Future list({String search = null, int limit = 25, int offset = null, String orderType = 'ASC'}) async { String path = '/teams'; Map params = { @@ -19,13 +24,13 @@ class Teams extends Service { 'orderType': orderType, }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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. - Future create({name, roles = const ["owner"]}) async { + Future create({@required String name, List roles = const ["owner"]}) async { String path = '/teams'; Map params = { @@ -33,48 +38,48 @@ class Teams extends Service { 'roles': roles, }; - return await this.client.call('post', path: path, params: params); + return await this.client.call(HttpMethod.post, path: path, params: params); } /// Get team by its unique ID. All team members have read access for this /// resource. - Future get({teamId}) async { + Future get({@required String teamId}) async { String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// Update team by its unique ID. Only team owners have write access for this /// resource. - Future update({teamId, name}) async { + Future update({@required String teamId, @required String name}) async { String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); Map params = { 'name': name, }; - return await this.client.call('put', path: path, params: params); + return await this.client.call(HttpMethod.put, path: path, params: params); } /// Delete team by its unique ID. Only team owners have write access for this /// resource. - Future delete({teamId}) async { + Future delete({@required String teamId}) async { String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); Map params = { }; - return await this.client.call('delete', path: path, params: params); + return await this.client.call(HttpMethod.delete, path: path, params: params); } /// Get team members by the team unique ID. All team members have read access /// for this list of resources. - Future getMemberships({teamId}) async { + Future getMemberships({@required String teamId}) async { String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); Map params = { }; - return await this.client.call('get', path: path, params: params); + return await this.client.call(HttpMethod.get, path: path, params: params); } /// 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 @@ -89,7 +94,7 @@ class Teams extends Service { /// 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. - Future createMembership({teamId, email, roles, url, name = null}) async { + Future createMembership({@required String teamId, @required String email, @required List roles, @required String url, String name = null}) async { String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); Map params = { @@ -99,23 +104,23 @@ class Teams extends Service { 'url': url, }; - return await this.client.call('post', path: path, params: params); + return await this.client.call(HttpMethod.post, path: path, params: params); } /// 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. - Future deleteMembership({teamId, inviteId}) async { + Future deleteMembership({@required String teamId, @required String inviteId}) async { String path = '/teams/{teamId}/memberships/{inviteId}'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); Map params = { }; - return await this.client.call('delete', path: path, params: params); + return await this.client.call(HttpMethod.delete, path: path, params: params); } /// 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. - Future updateMembershipStatus({teamId, inviteId, userId, secret}) async { + Future updateMembershipStatus({@required String teamId, @required String inviteId, @required String userId, @required String secret}) async { String path = '/teams/{teamId}/memberships/{inviteId}/status'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); Map params = { @@ -123,6 +128,6 @@ class Teams extends Service { 'secret': secret, }; - return await this.client.call('patch', path: path, params: params); + return await this.client.call(HttpMethod.patch, path: path, params: params); } } \ No newline at end of file diff --git a/app/sdks/flutter-dart/pubspec.yaml b/app/sdks/flutter-dart/pubspec.yaml index 3cb67dc787..fca3f7f507 100644 --- a/app/sdks/flutter-dart/pubspec.yaml +++ b/app/sdks/flutter-dart/pubspec.yaml @@ -4,7 +4,7 @@ description: Appwrite backend as a service cuts up to 70% of the time and costs author: Appwrite Team homepage: https://github.com/appwrite/sdk-for-dart environment: - sdk: '>=2.2.2 <3.0.0' + sdk: '>=2.6.0 <3.0.0' dependencies: dio: ^3.0.0 cookie_jar: ^1.0.0 diff --git a/app/sdks/server-go/README.md b/app/sdks/server-go/README.md index f11b213ddf..b9bbe4a077 100644 --- a/app/sdks/server-go/README.md +++ b/app/sdks/server-go/README.md @@ -1,7 +1,7 @@ # Appwrite SDK for Go ![License](https://img.shields.io/github/license/appwrite/sdk-for-go.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.5.0-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) **This SDK is compatible with Appwrite server version . For older versions, please check previous releases.** @@ -19,6 +19,10 @@ To install using `go get`: go get github.com/appwrite/sdk-for-go ``` +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + ## License Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/server-nodejs/README.md b/app/sdks/server-nodejs/README.md index 3e0b06818b..76ba6d4de2 100644 --- a/app/sdks/server-nodejs/README.md +++ b/app/sdks/server-nodejs/README.md @@ -1,7 +1,7 @@ # Appwrite SDK for NodeJS ![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.5.0-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -17,6 +17,10 @@ To install via [NPM](https://www.npmjs.com/): npm install node-appwrite --save ``` +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + ## License Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/server-php/README.md b/app/sdks/server-php/README.md index b0a8bc90bd..9470cf512d 100644 --- a/app/sdks/server-php/README.md +++ b/app/sdks/server-php/README.md @@ -1,7 +1,7 @@ # Appwrite SDK for PHP ![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.5.0-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -17,6 +17,10 @@ To install via [Composer](http://getcomposer.org/): composer require appwrite/appwrite ``` +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + ## License Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/server-python/README.md b/app/sdks/server-python/README.md index 84ad580d4d..f6b4fec7ae 100644 --- a/app/sdks/server-python/README.md +++ b/app/sdks/server-python/README.md @@ -1,7 +1,7 @@ # Appwrite SDK for Python ![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.5.0-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) **This SDK is compatible with Appwrite server version . For older versions, please check previous releases.** @@ -19,6 +19,10 @@ To install via [PyPI](https://pypi.org/): pip install appwrite ``` +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + ## License Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/server-ruby/README.md b/app/sdks/server-ruby/README.md index 67e7a0fb24..3787c28124 100644 --- a/app/sdks/server-ruby/README.md +++ b/app/sdks/server-ruby/README.md @@ -1,7 +1,7 @@ # Appwrite SDK for Ruby ![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.5.0-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) **This SDK is compatible with Appwrite server version . For older versions, please check previous releases.** @@ -19,6 +19,10 @@ To install via [Gem](https://rubygems.org/): gem install appwrite --save ``` +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + ## License Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/web-javascript/README.md b/app/sdks/web-javascript/README.md index 886401014c..26cb9154da 100644 --- a/app/sdks/web-javascript/README.md +++ b/app/sdks/web-javascript/README.md @@ -1,7 +1,7 @@ # Appwrite SDK for JavaScript ![License](https://img.shields.io/github/license/appwrite/sdk-for-js.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.5.0-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -33,6 +33,10 @@ To install with a CDN (content delivery network) add the following scripts to th +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + ## License Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index 7b3866ff81..c768bf48ca 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -15,6 +15,7 @@ use Appwrite\SDK\Language\Python; use Appwrite\SDK\Language\Ruby; use Appwrite\SDK\Language\Dart; use Appwrite\SDK\Language\Go; +use Appwrite\SDK\Language\Typescript; $cli = new CLI(); @@ -40,6 +41,7 @@ $cli $platforms = include __DIR__ . '/../config/platforms.php'; $message = Console::confirm('Please enter your commit message:'); + $production = (Console::confirm('Type "Appwrite" to deploy for production') == 'Appwrite'); foreach($platforms as $key => $platform) { foreach($platform['languages'] as $language) { @@ -51,7 +53,7 @@ $cli Console::info('Fetching API Spec for '.$language['name'].' for '.$platform['name']); //$spec = getSSLPage('http://localhost/v1/open-api-2.json?extensions=1&platform='.$language['family']); - $spec = getSSLPage('https://stage.appwrite.io/v1/open-api-2.json?extensions=1&platform='.$language['family']); + $spec = getSSLPage('https://appwrite.io/v1/open-api-2.json?extensions=1&platform='.$language['family']); $result = realpath(__DIR__.'/..').'/sdks/'.$key.'-'.$language['key']; $target = realpath(__DIR__.'/..').'/sdks/git/'.$language['key'].'/'; @@ -87,6 +89,13 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ->setBowerPackage('appwrite') ; break; + case 'typescript': + $config = new Typescript(); + $config + ->setNPMPackage('appwrite') + ->setBowerPackage('appwrite') + ; + break; case 'nodejs': $config = new Node(); $config @@ -157,7 +166,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND continue; } - #$gitUrl = 'git@github.com:aw-tests/'.$language['gitRepoName'].'.git'; + if(!$production) { + $gitUrl = 'git@github.com:aw-tests/'.$language['gitRepoName'].'.git'; + } exec('rm -rf '.$target.' && \ mkdir -p '.$target.' && \