From 3937e10a1dd283324b4a31849dbdae43aa152f8c Mon Sep 17 00:00:00 2001 From: eldadfux Date: Mon, 21 Oct 2019 21:03:06 +0300 Subject: [PATCH] Updated SDKs --- app/sdks/dart/.packages | 2 +- app/sdks/dart/README.md | 2 +- app/sdks/dart/lib/client.dart | 2 +- app/sdks/dart/lib/services/database.dart | 2 +- app/sdks/dart/lib/services/storage.dart | 2 +- app/sdks/dart/pubspec.yaml | 2 +- .../examples/Database/update-collection.md | 2 +- .../go/docs/examples/Storage/create-file.md | 2 +- app/sdks/js/README.md | 2 +- .../examples/database/update-collection.md | 2 +- .../js/docs/examples/storage/create-file.md | 2 +- app/sdks/js/package.json | 2 +- app/sdks/js/src/sdk.js | 22 ++++++++++++++++--- app/sdks/js/src/sdk.min.js | 10 ++++++--- .../examples/database/update-collection.md | 2 +- .../node/docs/examples/storage/create-file.md | 2 +- app/sdks/node/lib/client.js | 2 +- app/sdks/node/lib/services/database.js | 2 +- app/sdks/node/lib/services/storage.js | 2 +- app/sdks/node/package.json | 2 +- app/sdks/php/docs/database.md | 4 ++-- .../examples/database/update-collection.md | 2 +- .../php/docs/examples/storage/create-file.md | 2 +- app/sdks/php/docs/storage.md | 4 ++-- app/sdks/php/src/Appwrite/Client.php | 2 +- .../php/src/Appwrite/Services/Database.php | 2 +- .../php/src/Appwrite/Services/Storage.php | 2 +- app/sdks/python/appwrite/client.py | 2 +- app/sdks/python/appwrite/services/database.py | 4 +--- app/sdks/python/appwrite/services/storage.py | 4 +--- app/sdks/python/setup.py | 4 ++-- app/sdks/ruby/appwrite.gemspec | 2 +- app/sdks/ruby/lib/appwrite/client.rb | 2 +- .../ruby/lib/appwrite/services/database.rb | 2 +- .../ruby/lib/appwrite/services/storage.rb | 2 +- app/tasks/sdks.php | 14 ++++++------ 36 files changed, 69 insertions(+), 53 deletions(-) diff --git a/app/sdks/dart/.packages b/app/sdks/dart/.packages index aa6ceba06..65fa5cdd1 100644 --- a/app/sdks/dart/.packages +++ b/app/sdks/dart/.packages @@ -1,4 +1,4 @@ -# Generated by pub on 2019-10-21 20:31:27.216778. +# Generated by pub on 2019-10-21 21:02:22.266690. charcode:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/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/ diff --git a/app/sdks/dart/README.md b/app/sdks/dart/README.md index eba320044..d1eba8f20 100644 --- a/app/sdks/dart/README.md +++ b/app/sdks/dart/README.md @@ -17,7 +17,7 @@ Add this to your package's pubspec.yaml file: ```yml dependencies: - appwrite: ^0.0.4 + appwrite: ^0.0.5 ``` You can install packages from the command line: diff --git a/app/sdks/dart/lib/client.dart b/app/sdks/dart/lib/client.dart index 8e05880f8..af4a0e97b 100644 --- a/app/sdks/dart/lib/client.dart +++ b/app/sdks/dart/lib/client.dart @@ -12,7 +12,7 @@ class Client { this.endPoint = 'https://appwrite.io/v1'; this.headers = { 'content-type': 'application/json', - 'x-sdk-version': 'appwrite:dart:0.0.4', + 'x-sdk-version': 'appwrite:dart:0.0.5', }; this.selfSigned = false; diff --git a/app/sdks/dart/lib/services/database.dart b/app/sdks/dart/lib/services/database.dart index eba4bd507..5ecb54ad0 100644 --- a/app/sdks/dart/lib/services/database.dart +++ b/app/sdks/dart/lib/services/database.dart @@ -46,7 +46,7 @@ class Database extends Service { return await this.client.call('get', path: path, params: params); } /// Update collection by its unique ID. - Future updateCollection({collectionId, name, read = const [], write = const [], rules = const []}) async { + Future updateCollection({collectionId, name, read, write, rules = const []}) async { String path = '/database/{collectionId}'.replaceAll(RegExp('{collectionId}'), collectionId); Map params = { diff --git a/app/sdks/dart/lib/services/storage.dart b/app/sdks/dart/lib/services/storage.dart index 8db643c8a..7367986a0 100644 --- a/app/sdks/dart/lib/services/storage.dart +++ b/app/sdks/dart/lib/services/storage.dart @@ -24,7 +24,7 @@ class Storage extends Service { /// 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({files, read = const [], write = const [], folderId = null}) async { + Future createFile({files, read, write, folderId = null}) async { String path = '/storage/files'; Map params = { diff --git a/app/sdks/dart/pubspec.yaml b/app/sdks/dart/pubspec.yaml index d8eae7869..fc0f0a376 100644 --- a/app/sdks/dart/pubspec.yaml +++ b/app/sdks/dart/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 0.0.4 +version: 0.0.5 description: 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) author: Appwrite Team homepage: https://github.com/appwrite/sdk-for-dart diff --git a/app/sdks/go/docs/examples/Database/update-collection.md b/app/sdks/go/docs/examples/Database/update-collection.md index f6ab2b17e..7cf07ac2c 100644 --- a/app/sdks/go/docs/examples/Database/update-collection.md +++ b/app/sdks/go/docs/examples/Database/update-collection.md @@ -25,7 +25,7 @@ } // Call UpdateCollection method and handle results - var res, err := srv.UpdateCollection("[COLLECTION_ID]", "[NAME]") + var res, err := srv.UpdateCollection("[COLLECTION_ID]", "[NAME]", [], []) if err != nil { panic(err) } diff --git a/app/sdks/go/docs/examples/Storage/create-file.md b/app/sdks/go/docs/examples/Storage/create-file.md index 2b33879f5..1d0bf35af 100644 --- a/app/sdks/go/docs/examples/Storage/create-file.md +++ b/app/sdks/go/docs/examples/Storage/create-file.md @@ -25,7 +25,7 @@ } // Call CreateFile method and handle results - var res, err := srv.CreateFile(file) + var res, err := srv.CreateFile(file, [], []) if err != nil { panic(err) } diff --git a/app/sdks/js/README.md b/app/sdks/js/README.md index da873291d..974341a38 100644 --- a/app/sdks/js/README.md +++ b/app/sdks/js/README.md @@ -30,7 +30,7 @@ import * as Appwrite from "appwrite"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` ## Getting Started diff --git a/app/sdks/js/docs/examples/database/update-collection.md b/app/sdks/js/docs/examples/database/update-collection.md index 547d554e7..726c244c7 100644 --- a/app/sdks/js/docs/examples/database/update-collection.md +++ b/app/sdks/js/docs/examples/database/update-collection.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.database.updateCollection('[COLLECTION_ID]', '[NAME]'); +let promise = sdk.database.updateCollection('[COLLECTION_ID]', '[NAME]', [], []); promise.then(function (response) { console.log(response); diff --git a/app/sdks/js/docs/examples/storage/create-file.md b/app/sdks/js/docs/examples/storage/create-file.md index 7869e8348..53157d19a 100644 --- a/app/sdks/js/docs/examples/storage/create-file.md +++ b/app/sdks/js/docs/examples/storage/create-file.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.storage.createFile(document.getElementById('uploader').files[0]); +let promise = sdk.storage.createFile(document.getElementById('uploader').files[0], [], []); promise.then(function (response) { console.log(response); diff --git a/app/sdks/js/package.json b/app/sdks/js/package.json index 75c4af48b..499bfdd69 100644 --- a/app/sdks/js/package.json +++ b/app/sdks/js/package.json @@ -2,7 +2,7 @@ "name": "appwrite", "homepage": "https://appwrite.io/support", "description": "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)", - "version": "1.0.26", + "version": "1.0.27", "license": "BSD-3-Clause", "main": "src/sdk.js", "repository": { diff --git a/app/sdks/js/src/sdk.js b/app/sdks/js/src/sdk.js index b74816085..1608e3b49 100644 --- a/app/sdks/js/src/sdk.js +++ b/app/sdks/js/src/sdk.js @@ -139,7 +139,7 @@ globalParams.push({key: key, value: value}); }; - addGlobalHeader('x-sdk-version', 'appwrite:javascript:1.0.26'); + addGlobalHeader('x-sdk-version', 'appwrite:javascript:1.0.27'); addGlobalHeader('content-type', ''); /** @@ -1319,7 +1319,7 @@ * @throws {Error} * @return {Promise} */ - updateCollection: function(collectionId, name, read = [], write = [], rules = []) { + updateCollection: function(collectionId, name, read, write, rules = []) { if(collectionId === undefined) { throw new Error('Missing required parameter: "collectionId"'); } @@ -1328,6 +1328,14 @@ throw new Error('Missing required parameter: "name"'); } + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + let path = '/database/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); let payload = {}; @@ -2951,11 +2959,19 @@ * @throws {Error} * @return {Promise} */ - createFile: function(files, read = [], write = [], folderId = '') { + createFile: function(files, read, write, folderId = '') { if(files === undefined) { throw new Error('Missing required parameter: "files"'); } + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + let path = '/storage/files'; let payload = {}; diff --git a/app/sdks/js/src/sdk.min.js b/app/sdks/js/src/sdk.min.js index ccf998123..f4e06660b 100644 --- a/app/sdks/js/src/sdk.min.js +++ b/app/sdks/js/src/sdk.min.js @@ -1,5 +1,5 @@ (function(window){'use strict';window.Appwrite=function(){let config={endpoint:'https://appwrite.io/v1',project:'',key:'',locale:'',mode:'',};let setEndpoint=function(endpoint){config.endpoint=endpoint;return this};let setProject=function(value){http.addGlobalHeader('X-Appwrite-Project',value);config.project=value;return this};let setKey=function(value){http.addGlobalHeader('X-Appwrite-Key',value);config.key=value;return this};let setLocale=function(value){http.addGlobalHeader('X-Appwrite-Locale',value);config.locale=value;return this};let setMode=function(value){http.addGlobalHeader('X-Appwrite-Mode',value);config.mode=value;return this};let http=function(document){let globalParams=[],globalHeaders=[];let addParam=function(url,param,value){let a=document.createElement('a'),regex=/(?:\?|&|&)+([^=]+)(?:=([^&]*))*/g;let match,str=[];a.href=url;param=encodeURIComponent(param);while(match=regex.exec(a.search))if(param!==match[1])str.push(match[1]+(match[2]?"="+match[2]:""));str.push(param+(value?"="+encodeURIComponent(value):""));a.search=str.join("&");return a.href};let buildQuery=function(params){let str=[];for(let p in params){if(Array.isArray(params[p])){for(let index=0;indexupdateCollection('[COLLECTION_ID]', '[NAME]'); \ No newline at end of file +$result = $database->updateCollection('[COLLECTION_ID]', '[NAME]', [], []); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/create-file.md b/app/sdks/php/docs/examples/storage/create-file.md index 88a37d8e8..225b9e2be 100644 --- a/app/sdks/php/docs/examples/storage/create-file.md +++ b/app/sdks/php/docs/examples/storage/create-file.md @@ -12,4 +12,4 @@ $client $storage = new Storage($client); -$result = $storage->createFile(new \CURLFile('/path/to/file.png', 'image/png', 'file.png')); \ No newline at end of file +$result = $storage->createFile(new \CURLFile('/path/to/file.png', 'image/png', 'file.png'), [], []); \ No newline at end of file diff --git a/app/sdks/php/docs/storage.md b/app/sdks/php/docs/storage.md index bda64c636..f7833daf4 100644 --- a/app/sdks/php/docs/storage.md +++ b/app/sdks/php/docs/storage.md @@ -30,8 +30,8 @@ POST https://appwrite.io/v1/storage/files | Field Name | Type | Description | Default | | --- | --- | --- | --- | | files | file | Binary Files. | | -| read | array | An array of strings with read permissions. [Learn more about permissions and roles](/docs/permissions). | [] | -| write | array | An array of strings with write permissions. [Learn more about permissions and roles](/docs/permissions). | [] | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions and roles](/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 and roles](/docs/permissions) and get a full list of available permissions. | | | folderId | string | Folder to associate files with. | | ## Get File diff --git a/app/sdks/php/src/Appwrite/Client.php b/app/sdks/php/src/Appwrite/Client.php index 95f634241..4f575b14a 100644 --- a/app/sdks/php/src/Appwrite/Client.php +++ b/app/sdks/php/src/Appwrite/Client.php @@ -37,7 +37,7 @@ class Client */ protected $headers = [ 'content-type' => '', - 'x-sdk-version' => 'appwrite:php:1.0.14', + 'x-sdk-version' => 'appwrite:php:1.0.15', ]; /** diff --git a/app/sdks/php/src/Appwrite/Services/Database.php b/app/sdks/php/src/Appwrite/Services/Database.php index 8e7ef4344..f27c153e6 100644 --- a/app/sdks/php/src/Appwrite/Services/Database.php +++ b/app/sdks/php/src/Appwrite/Services/Database.php @@ -99,7 +99,7 @@ class Database extends Service * @throws Exception * @return array */ - public function updateCollection(string $collectionId, string $name, array $read = [], array $write = [], array $rules = []):array + public function updateCollection(string $collectionId, string $name, array $read, array $write, array $rules = []):array { $path = str_replace(['{collectionId}'], [$collectionId], '/database/{collectionId}'); $params = []; diff --git a/app/sdks/php/src/Appwrite/Services/Storage.php b/app/sdks/php/src/Appwrite/Services/Storage.php index 9773976ef..f2104150c 100644 --- a/app/sdks/php/src/Appwrite/Services/Storage.php +++ b/app/sdks/php/src/Appwrite/Services/Storage.php @@ -51,7 +51,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function createFile(\CurlFile $files, array $read = [], array $write = [], string $folderId = ''):array + public function createFile(\CurlFile $files, array $read, array $write, string $folderId = ''):array { $path = str_replace([], [], '/storage/files'); $params = []; diff --git a/app/sdks/python/appwrite/client.py b/app/sdks/python/appwrite/client.py index c296e735e..d2a9f1a04 100644 --- a/app/sdks/python/appwrite/client.py +++ b/app/sdks/python/appwrite/client.py @@ -7,7 +7,7 @@ class Client: self._endpoint = 'https://appwrite.io/v1' self._global_headers = { 'content-type': '', - 'x-sdk-version': 'appwrite:python:1.0.2', + 'x-sdk-version': 'appwrite:python:1.0.3', } def set_self_signed(self, status=True): diff --git a/app/sdks/python/appwrite/services/database.py b/app/sdks/python/appwrite/services/database.py index e94b81d19..55bd54f9f 100644 --- a/app/sdks/python/appwrite/services/database.py +++ b/app/sdks/python/appwrite/services/database.py @@ -42,9 +42,7 @@ class Database(Service): 'content-type': 'application/json', }, params) - def update_collection(self, collection_id, name, readstring(4) ""[]"" -=[], writestring(4) ""[]"" -=[], rulesstring(4) ""[]"" + def update_collection(self, collection_id, name, read, write, rulesstring(4) ""[]"" =[]): """Update Collection""" diff --git a/app/sdks/python/appwrite/services/storage.py b/app/sdks/python/appwrite/services/storage.py index ab7cddd2a..b15084bf2 100644 --- a/app/sdks/python/appwrite/services/storage.py +++ b/app/sdks/python/appwrite/services/storage.py @@ -17,9 +17,7 @@ class Storage(Service): 'content-type': 'application/json', }, params) - def create_file(self, files, readstring(4) ""[]"" -=[], writestring(4) ""[]"" -=[], folder_id=''): + def create_file(self, files, read, write, folder_id=''): """Create File""" params = {} diff --git a/app/sdks/python/setup.py b/app/sdks/python/setup.py index 9b5f69c64..119a1591b 100644 --- a/app/sdks/python/setup.py +++ b/app/sdks/python/setup.py @@ -3,7 +3,7 @@ from distutils.core import setup setup( name = 'appwrite', packages = ['appwrite'], - version = '1.0.2', + version = '1.0.3', license='BSD-3-Clause', description = '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)', author = 'Appwrite Team', @@ -11,7 +11,7 @@ setup( maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/1.0.2.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/1.0.3.tar.gz', # keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], install_requires=[ 'requests', diff --git a/app/sdks/ruby/appwrite.gemspec b/app/sdks/ruby/appwrite.gemspec index 68d58653f..c28a7a8e9 100644 --- a/app/sdks/ruby/appwrite.gemspec +++ b/app/sdks/ruby/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'appwrite' - s.version = '1.0.6' + s.version = '1.0.7' s.summary = "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)" s.author = 'Appwrite Team' s.homepage = 'https://appwrite.io/support' diff --git a/app/sdks/ruby/lib/appwrite/client.rb b/app/sdks/ruby/lib/appwrite/client.rb index eb1352fbc..23fad2cff 100644 --- a/app/sdks/ruby/lib/appwrite/client.rb +++ b/app/sdks/ruby/lib/appwrite/client.rb @@ -20,7 +20,7 @@ module Appwrite @headers = { 'content-type' => '', 'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION, - 'x-sdk-version' => 'appwrite:ruby:1.0.6' + 'x-sdk-version' => 'appwrite:ruby:1.0.7' } @endpoint = 'https://appwrite.io/v1'; end diff --git a/app/sdks/ruby/lib/appwrite/services/database.rb b/app/sdks/ruby/lib/appwrite/services/database.rb index b3483ab9e..cf1171248 100644 --- a/app/sdks/ruby/lib/appwrite/services/database.rb +++ b/app/sdks/ruby/lib/appwrite/services/database.rb @@ -43,7 +43,7 @@ module Appwrite }, params); end - def update_collection(collection_id:, name:, read: [], write: [], rules: []) + def update_collection(collection_id:, name:, read:, write:, rules: []) path = '/database/{collectionId}' .gsub('{collection_id}', collection_id) diff --git a/app/sdks/ruby/lib/appwrite/services/storage.rb b/app/sdks/ruby/lib/appwrite/services/storage.rb index 902a9dcf6..3401611c8 100644 --- a/app/sdks/ruby/lib/appwrite/services/storage.rb +++ b/app/sdks/ruby/lib/appwrite/services/storage.rb @@ -16,7 +16,7 @@ module Appwrite }, params); end - def create_file(files:, read: [], write: [], folder_id: '') + def create_file(files:, read:, write:, folder_id: '') path = '/storage/files' params = { diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index d29e64bf6..08c308882 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -39,7 +39,7 @@ $cli $clients = [ 'php' => [ - 'version' => '1.0.14', + 'version' => '1.0.15', 'result' => __DIR__.'/../sdks/php/', 'gitURL' => 'https://github.com/appwrite/sdk-for-php.git', 'gitRepo' => 'git@github.com:appwrite/sdk-for-php.git', @@ -50,7 +50,7 @@ $cli 'platform' => 'server', ], 'js' => [ - 'version' => '1.0.26', + 'version' => '1.0.27', 'result' => __DIR__.'/../sdks/js/', 'gitURL' => 'https://github.com/appwrite/sdk-for-js.git', 'gitRepo' => 'git@github.com:appwrite/sdk-for-js.git', @@ -61,7 +61,7 @@ $cli 'platform' => 'client', ], 'node' => [ - 'version' => '1.0.29', + 'version' => '1.0.30', 'result' => __DIR__.'/../sdks/node/', 'gitURL' => 'https://github.com/appwrite/sdk-for-node.git', 'gitRepo' => 'git@github.com:appwrite/sdk-for-node.git', @@ -72,7 +72,7 @@ $cli 'platform' => 'server', ], 'python' => [ - 'version' => '1.0.2', + 'version' => '1.0.3', 'result' => __DIR__.'/../sdks/python/', 'gitURL' => 'https://github.com/appwrite/sdk-for-python.git', 'gitRepo' => 'git@github.com:appwrite/sdk-for-python.git', @@ -83,7 +83,7 @@ $cli 'platform' => 'server', ], 'ruby' => [ - 'version' => '1.0.6', + 'version' => '1.0.7', 'result' => __DIR__.'/../sdks/ruby/', 'gitURL' => 'https://github.com/appwrite/sdk-for-ruby.git', 'gitRepo' => 'git@github.com:appwrite/sdk-for-ruby.git', @@ -94,7 +94,7 @@ $cli 'platform' => 'server', ], 'dart' => [ - 'version' => '0.0.4', + 'version' => '0.0.5', 'result' => __DIR__.'/../sdks/dart/', 'gitURL' => 'https://github.com/appwrite/sdk-for-dart', 'gitRepo' => 'git@github.com:appwrite/sdk-for-dart.git', @@ -105,7 +105,7 @@ $cli 'platform' => 'client', ], 'go' => [ - 'version' => '0.0.3', + 'version' => '0.0.4', 'result' => __DIR__.'/../sdks/go/', 'gitURL' => 'https://github.com/appwrite/sdk-for-go', 'gitRepo' => 'git@github.com:appwrite/sdk-for-go.git',