From 5c6ab780646990f62d91590005c9695fd3b34bd5 Mon Sep 17 00:00:00 2001 From: eldadfux Date: Mon, 21 Oct 2019 20:15:27 +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 | 4 +- app/sdks/dart/lib/services/locale.dart | 20 ++++-- app/sdks/dart/lib/services/storage.dart | 2 +- app/sdks/dart/pubspec.yaml | 2 +- .../docs/examples/Database/create-document.md | 2 +- .../docs/examples/Database/update-document.md | 2 +- .../go/docs/examples/Locale/get-continents.md | 35 +++++++++++ .../go/docs/examples/Storage/update-file.md | 2 +- app/sdks/go/locale.go | 21 +++++-- app/sdks/js/README.md | 4 +- .../docs/examples/database/create-document.md | 2 +- .../docs/examples/database/update-document.md | 2 +- .../js/docs/examples/locale/get-continents.md | 13 ++++ .../js/docs/examples/storage/update-file.md | 2 +- app/sdks/js/package.json | 2 +- app/sdks/js/src/sdk.js | 62 ++++++++++++++++--- app/sdks/js/src/sdk.min.js | 16 +++-- app/sdks/node/README.md | 2 +- .../docs/examples/database/create-document.md | 2 +- .../docs/examples/database/update-document.md | 2 +- .../docs/examples/locale/get-continents.md | 19 ++++++ .../node/docs/examples/storage/update-file.md | 2 +- app/sdks/node/lib/client.js | 2 +- app/sdks/node/lib/services/database.js | 4 +- app/sdks/node/lib/services/locale.js | 29 +++++++-- app/sdks/node/lib/services/storage.js | 2 +- app/sdks/node/package.json | 2 +- app/sdks/php/README.md | 2 +- app/sdks/php/docs/database.md | 12 ++-- .../docs/examples/database/create-document.md | 2 +- .../docs/examples/database/update-document.md | 2 +- .../docs/examples/locale/get-continents.md | 15 +++++ .../php/docs/examples/storage/update-file.md | 2 +- app/sdks/php/docs/locale.md | 18 ++++-- app/sdks/php/docs/storage.md | 4 +- app/sdks/php/docs/users.md | 2 +- app/sdks/php/src/Appwrite/Client.php | 2 +- .../php/src/Appwrite/Services/Database.php | 4 +- app/sdks/php/src/Appwrite/Services/Locale.php | 30 +++++++-- .../php/src/Appwrite/Services/Storage.php | 2 +- app/sdks/python/appwrite/client.py | 2 +- app/sdks/python/appwrite/services/database.py | 8 +-- app/sdks/python/appwrite/services/locale.py | 10 +++ 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 | 4 +- app/sdks/ruby/lib/appwrite/services/locale.rb | 11 ++++ .../ruby/lib/appwrite/services/storage.rb | 2 +- app/tasks/sdks.php | 14 ++--- 54 files changed, 320 insertions(+), 105 deletions(-) create mode 100644 app/sdks/go/docs/examples/Locale/get-continents.md create mode 100644 app/sdks/js/docs/examples/locale/get-continents.md create mode 100644 app/sdks/node/docs/examples/locale/get-continents.md create mode 100644 app/sdks/php/docs/examples/locale/get-continents.md diff --git a/app/sdks/dart/.packages b/app/sdks/dart/.packages index a4f764b10..46217d97f 100644 --- a/app/sdks/dart/.packages +++ b/app/sdks/dart/.packages @@ -1,4 +1,4 @@ -# Generated by pub on 2019-10-20 15:13:23.423618. +# Generated by pub on 2019-10-21 20:14:37.175223. 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 effbe7922..1ef232117 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.2 + appwrite: ^0.0.4 ``` 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 c03342e33..8e05880f8 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.2', + 'x-sdk-version': 'appwrite:dart:0.0.4', }; this.selfSigned = false; diff --git a/app/sdks/dart/lib/services/database.dart b/app/sdks/dart/lib/services/database.dart index 13e740746..eba4bd507 100644 --- a/app/sdks/dart/lib/services/database.dart +++ b/app/sdks/dart/lib/services/database.dart @@ -90,7 +90,7 @@ class Database extends Service { return await this.client.call('get', path: path, params: params); } /// Create a new Document. - Future createDocument({collectionId, data, read = const [], write = const [], parentDocument = null, parentProperty = null, parentPropertyType = 'assign'}) async { + Future createDocument({collectionId, data, read, write, parentDocument = null, parentProperty = null, parentPropertyType = 'assign'}) async { String path = '/database/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); Map params = { @@ -114,7 +114,7 @@ class Database extends Service { return await this.client.call('get', path: path, params: params); } - Future updateDocument({collectionId, documentId, data, read = const [], write = const []}) async { + Future updateDocument({collectionId, documentId, data, read, write}) async { String path = '/database/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); Map params = { diff --git a/app/sdks/dart/lib/services/locale.dart b/app/sdks/dart/lib/services/locale.dart index 29f87ac5e..6112ada3e 100644 --- a/app/sdks/dart/lib/services/locale.dart +++ b/app/sdks/dart/lib/services/locale.dart @@ -8,7 +8,7 @@ class Locale extends Service { /// Get the current user location based on IP. Returns an object with user /// country code, country name, continent name, continent code, ip address and - /// suggested currency. You can use the locale header to get the data in + /// suggested currency. You can use the locale header to get the data in a /// supported language. Future getLocale() async { String path = '/locale'; @@ -18,7 +18,17 @@ class Locale extends Service { return await this.client.call('get', path: path, params: params); } - /// List of all countries. You can use the locale header to get the data in + /// List of all continents. You can use the locale header to get the data in a + /// supported language. + Future getContinents() async { + String path = '/locale/continents'; + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } + /// List of all countries. You can use the locale header to get the data in a /// supported language. Future getCountries() async { String path = '/locale/countries'; @@ -29,7 +39,7 @@ class Locale extends Service { return await this.client.call('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 supported language. UK brexit date is + /// locale header to get the data in a supported language. UK brexit date is /// currently set to 2019-10-31 and will be updated if and when needed. Future getCountriesEU() async { String path = '/locale/countries/eu'; @@ -40,7 +50,7 @@ class Locale extends Service { return await this.client.call('get', path: path, params: params); } /// List of all countries phone codes. You can use the locale header to get the - /// data in supported language. + /// data in a supported language. Future getCountriesPhones() async { String path = '/locale/countries/phones'; @@ -51,7 +61,7 @@ class Locale extends Service { } /// 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 - /// get the data in supported language. + /// get the data in a supported language. Future getCurrencies() async { String path = '/locale/currencies'; diff --git a/app/sdks/dart/lib/services/storage.dart b/app/sdks/dart/lib/services/storage.dart index 373cc4419..8db643c8a 100644 --- a/app/sdks/dart/lib/services/storage.dart +++ b/app/sdks/dart/lib/services/storage.dart @@ -48,7 +48,7 @@ class Storage extends Service { } /// Update file by its unique ID. Only users with write permissions have access /// to update this resource. - Future updateFile({fileId, read = const [], write = const [], folderId = null}) async { + Future updateFile({fileId, read, write, folderId = null}) async { String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); Map params = { diff --git a/app/sdks/dart/pubspec.yaml b/app/sdks/dart/pubspec.yaml index fbf132c38..d8eae7869 100644 --- a/app/sdks/dart/pubspec.yaml +++ b/app/sdks/dart/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 0.0.2 +version: 0.0.4 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/create-document.md b/app/sdks/go/docs/examples/Database/create-document.md index ab9aa9e60..ccaa02f57 100644 --- a/app/sdks/go/docs/examples/Database/create-document.md +++ b/app/sdks/go/docs/examples/Database/create-document.md @@ -25,7 +25,7 @@ } // Call CreateDocument method and handle results - var res, err := srv.CreateDocument("[COLLECTION_ID]", "{}") + var res, err := srv.CreateDocument("[COLLECTION_ID]", "{}", [], []) if err != nil { panic(err) } diff --git a/app/sdks/go/docs/examples/Database/update-document.md b/app/sdks/go/docs/examples/Database/update-document.md index 6a2775e71..88f57eefa 100644 --- a/app/sdks/go/docs/examples/Database/update-document.md +++ b/app/sdks/go/docs/examples/Database/update-document.md @@ -25,7 +25,7 @@ } // Call UpdateDocument method and handle results - var res, err := srv.UpdateDocument("[COLLECTION_ID]", "[DOCUMENT_ID]", "{}") + var res, err := srv.UpdateDocument("[COLLECTION_ID]", "[DOCUMENT_ID]", "{}", [], []) if err != nil { panic(err) } diff --git a/app/sdks/go/docs/examples/Locale/get-continents.md b/app/sdks/go/docs/examples/Locale/get-continents.md new file mode 100644 index 000000000..faeab3a97 --- /dev/null +++ b/app/sdks/go/docs/examples/Locale/get-continents.md @@ -0,0 +1,35 @@ +# Locale Examples + +## GetContinents + +```go + package appwrite-getcontinents + + import ( + "fmt" + "os" + "github.com/appwrite/sdk-for-go" + ) + + func main() { + // Create a Client + var clt := appwrite.Client{} + + // Set Client required headers + clt.SetProject("") + clt.SetKey("") + + // Create a new Locale service passing Client + var srv := appwrite.Locale{ + client: &clt + } + + // Call GetContinents method and handle results + var res, err := srv.GetContinents() + if err != nil { + panic(err) + } + + fmt.Println(res) + } +``` \ No newline at end of file diff --git a/app/sdks/go/docs/examples/Storage/update-file.md b/app/sdks/go/docs/examples/Storage/update-file.md index 157d44b7a..01b44bc62 100644 --- a/app/sdks/go/docs/examples/Storage/update-file.md +++ b/app/sdks/go/docs/examples/Storage/update-file.md @@ -25,7 +25,7 @@ } // Call UpdateFile method and handle results - var res, err := srv.UpdateFile("[FILE_ID]") + var res, err := srv.UpdateFile("[FILE_ID]", [], []) if err != nil { panic(err) } diff --git a/app/sdks/go/locale.go b/app/sdks/go/locale.go index b5711c64d..fa6697118 100644 --- a/app/sdks/go/locale.go +++ b/app/sdks/go/locale.go @@ -10,7 +10,7 @@ type Locale struct { // GetLocale get the current user location based on IP. Returns an object with // user country code, country name, continent name, continent code, ip address -// and suggested currency. You can use the locale header to get the data in +// and suggested currency. You can use the locale header to get the data in a // supported language. func (srv *Locale) GetLocale() (map[string]interface{}, error) { path := "/locale" @@ -21,8 +21,19 @@ func (srv *Locale) GetLocale() (map[string]interface{}, error) { return srv.client.Call("GET", path, nil, params) } +// GetContinents list of all continents. You can use the locale header to get +// the data in a supported language. +func (srv *Locale) GetContinents() (map[string]interface{}, error) { + path := "/locale/continents" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + // GetCountries list of all countries. You can use the locale header to get -// the data in supported language. +// the data in a supported language. func (srv *Locale) GetCountries() (map[string]interface{}, error) { path := "/locale/countries" @@ -33,7 +44,7 @@ func (srv *Locale) GetCountries() (map[string]interface{}, error) { } // GetCountriesEU list of all countries that are currently members of the EU. -// You can use the locale header to get the data in supported language. UK +// You can use the locale header to get the data in a supported language. UK // brexit date is currently set to 2019-10-31 and will be updated if and when // needed. func (srv *Locale) GetCountriesEU() (map[string]interface{}, error) { @@ -46,7 +57,7 @@ func (srv *Locale) GetCountriesEU() (map[string]interface{}, error) { } // GetCountriesPhones list of all countries phone codes. You can use the -// locale header to get the data in supported language. +// locale header to get the data in a supported language. func (srv *Locale) GetCountriesPhones() (map[string]interface{}, error) { path := "/locale/countries/phones" @@ -58,7 +69,7 @@ func (srv *Locale) GetCountriesPhones() (map[string]interface{}, error) { // GetCurrencies 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 get the data in supported language. +// the locale header to get the data in a supported language. func (srv *Locale) GetCurrencies() (map[string]interface{}, error) { path := "/locale/currencies" diff --git a/app/sdks/js/README.md b/app/sdks/js/README.md index 1fd77146a..305d90b9c 100644 --- a/app/sdks/js/README.md +++ b/app/sdks/js/README.md @@ -3,7 +3,7 @@ ![License](https://img.shields.io/github/license/appwrite/sdk-for-js.svg?v=1) ![Version](https://img.shields.io/badge/api%20version-0.2.0-blue.svg?v=1) -**This SDK is compatible with Appwrite server version 0.2.0. For older versions, please check previous releases.** +**This SDK is compatible with Appwrite server version 0.3.0. For older versions, please check previous releases.** 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) @@ -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/create-document.md b/app/sdks/js/docs/examples/database/create-document.md index 00bf9e9f8..aa251ae2b 100644 --- a/app/sdks/js/docs/examples/database/create-document.md +++ b/app/sdks/js/docs/examples/database/create-document.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.database.createDocument('[COLLECTION_ID]', '{}'); +let promise = sdk.database.createDocument('[COLLECTION_ID]', '{}', [], []); promise.then(function (response) { console.log(response); diff --git a/app/sdks/js/docs/examples/database/update-document.md b/app/sdks/js/docs/examples/database/update-document.md index 3790154d1..7809b97bf 100644 --- a/app/sdks/js/docs/examples/database/update-document.md +++ b/app/sdks/js/docs/examples/database/update-document.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', '{}'); +let promise = sdk.database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', '{}', [], []); promise.then(function (response) { console.log(response); diff --git a/app/sdks/js/docs/examples/locale/get-continents.md b/app/sdks/js/docs/examples/locale/get-continents.md new file mode 100644 index 000000000..a8de63eb9 --- /dev/null +++ b/app/sdks/js/docs/examples/locale/get-continents.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.locale.getContinents(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/js/docs/examples/storage/update-file.md b/app/sdks/js/docs/examples/storage/update-file.md index 30380a0fb..72d6ee316 100644 --- a/app/sdks/js/docs/examples/storage/update-file.md +++ b/app/sdks/js/docs/examples/storage/update-file.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.storage.updateFile('[FILE_ID]'); +let promise = sdk.storage.updateFile('[FILE_ID]', [], []); promise.then(function (response) { console.log(response); diff --git a/app/sdks/js/package.json b/app/sdks/js/package.json index dd86b8a8f..75c4af48b 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.24", + "version": "1.0.26", "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 544f24a02..b74816085 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.24'); + addGlobalHeader('x-sdk-version', 'appwrite:javascript:1.0.26'); addGlobalHeader('content-type', ''); /** @@ -1466,7 +1466,7 @@ * @throws {Error} * @return {Promise} */ - createDocument: function(collectionId, data, read = [], write = [], parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { + createDocument: function(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { if(collectionId === undefined) { throw new Error('Missing required parameter: "collectionId"'); } @@ -1475,6 +1475,14 @@ throw new Error('Missing required parameter: "data"'); } + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + let path = '/database/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); let payload = {}; @@ -1551,7 +1559,7 @@ * @throws {Error} * @return {Promise} */ - updateDocument: function(collectionId, documentId, data, read = [], write = []) { + updateDocument: function(collectionId, documentId, data, read, write) { if(collectionId === undefined) { throw new Error('Missing required parameter: "collectionId"'); } @@ -1564,6 +1572,14 @@ throw new Error('Missing required parameter: "data"'); } + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + let path = '/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); let payload = {}; @@ -1625,7 +1641,7 @@ * * Get the current user location based on IP. Returns an object with user * country code, country name, continent name, continent code, ip address and - * suggested currency. You can use the locale header to get the data in + * suggested currency. You can use the locale header to get the data in a * supported language. * * @throws {Error} @@ -1645,7 +1661,27 @@ /** * List Countries * - * List of all countries. You can use the locale header to get the data in + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents: function() { + let path = '/locale/continents'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a * supported language. * * @throws {Error} @@ -1666,7 +1702,7 @@ * List EU Countries * * List of all countries that are currently members of the EU. You can use the - * locale header to get the data in supported language. UK brexit date is + * locale header to get the data in a supported language. UK brexit date is * currently set to 2019-10-31 and will be updated if and when needed. * * @throws {Error} @@ -1687,7 +1723,7 @@ * List Countries Phone Codes * * List of all countries phone codes. You can use the locale header to get the - * data in supported language. + * data in a supported language. * * @throws {Error} * @return {Promise} @@ -1708,7 +1744,7 @@ * * 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 - * get the data in supported language. + * get the data in a supported language. * * @throws {Error} * @return {Promise} @@ -2984,11 +3020,19 @@ * @throws {Error} * @return {Promise} */ - updateFile: function(fileId, read = [], write = [], folderId = '') { + updateFile: function(fileId, read, write, folderId = '') { if(fileId === undefined) { throw new Error('Missing required parameter: "fileId"'); } + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); let payload = {}; diff --git a/app/sdks/js/src/sdk.min.js b/app/sdks/js/src/sdk.min.js index 75df47faa..ccf998123 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;indexcreateDocument('[COLLECTION_ID]', '{}'); \ No newline at end of file +$result = $database->createDocument('[COLLECTION_ID]', '{}', [], []); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/database/update-document.md b/app/sdks/php/docs/examples/database/update-document.md index 510e38808..2051d0977 100644 --- a/app/sdks/php/docs/examples/database/update-document.md +++ b/app/sdks/php/docs/examples/database/update-document.md @@ -12,4 +12,4 @@ $client $database = new Database($client); -$result = $database->updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', '{}'); \ No newline at end of file +$result = $database->updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', '{}', [], []); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/locale/get-continents.md b/app/sdks/php/docs/examples/locale/get-continents.md new file mode 100644 index 000000000..22b1528c0 --- /dev/null +++ b/app/sdks/php/docs/examples/locale/get-continents.md @@ -0,0 +1,15 @@ +setProject('') + ->setKey('') +; + +$locale = new Locale($client); + +$result = $locale->getContinents(); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/update-file.md b/app/sdks/php/docs/examples/storage/update-file.md index 93dc6bb18..637870a7a 100644 --- a/app/sdks/php/docs/examples/storage/update-file.md +++ b/app/sdks/php/docs/examples/storage/update-file.md @@ -12,4 +12,4 @@ $client $storage = new Storage($client); -$result = $storage->updateFile('[FILE_ID]'); \ No newline at end of file +$result = $storage->updateFile('[FILE_ID]', [], []); \ No newline at end of file diff --git a/app/sdks/php/docs/locale.md b/app/sdks/php/docs/locale.md index 91956eee3..16cce2f9c 100644 --- a/app/sdks/php/docs/locale.md +++ b/app/sdks/php/docs/locale.md @@ -6,7 +6,15 @@ GET https://appwrite.io/v1/locale ``` -** Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in supported language. ** +** Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. ** + +## List Countries + +```http request +GET https://appwrite.io/v1/locale/continents +``` + +** List of all continents. You can use the locale header to get the data in a supported language. ** ## List Countries @@ -14,7 +22,7 @@ GET https://appwrite.io/v1/locale GET https://appwrite.io/v1/locale/countries ``` -** List of all countries. You can use the locale header to get the data in supported language. ** +** List of all countries. You can use the locale header to get the data in a supported language. ** ## List EU Countries @@ -22,7 +30,7 @@ GET https://appwrite.io/v1/locale/countries GET https://appwrite.io/v1/locale/countries/eu ``` -** List of all countries that are currently members of the EU. You can use the locale header to get the data in supported language. UK brexit date is currently set to 2019-10-31 and will be updated if and when needed. ** +** 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. UK brexit date is currently set to 2019-10-31 and will be updated if and when needed. ** ## List Countries Phone Codes @@ -30,7 +38,7 @@ GET https://appwrite.io/v1/locale/countries/eu GET https://appwrite.io/v1/locale/countries/phones ``` -** List of all countries phone codes. You can use the locale header to get the data in supported language. ** +** List of all countries phone codes. You can use the locale header to get the data in a supported language. ** ## List of currencies @@ -38,5 +46,5 @@ GET https://appwrite.io/v1/locale/countries/phones GET https://appwrite.io/v1/locale/currencies ``` -** 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 get the data in supported language. ** +** 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 get the data in a supported language. ** diff --git a/app/sdks/php/docs/storage.md b/app/sdks/php/docs/storage.md index 177357eea..bda64c636 100644 --- a/app/sdks/php/docs/storage.md +++ b/app/sdks/php/docs/storage.md @@ -61,8 +61,8 @@ PUT https://appwrite.io/v1/storage/files/{fileId} | Field Name | Type | Description | Default | | --- | --- | --- | --- | | fileId | string | **Required** File unique ID. | | -| 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. | | ## Delete File diff --git a/app/sdks/php/docs/users.md b/app/sdks/php/docs/users.md index 91ae67139..fedcd71d5 100644 --- a/app/sdks/php/docs/users.md +++ b/app/sdks/php/docs/users.md @@ -146,5 +146,5 @@ PATCH https://appwrite.io/v1/users/{userId}/status | Field Name | Type | Description | Default | | --- | --- | --- | --- | | userId | string | **Required** User unique ID. | | -| status | string | User Status code. To activate the user pass 1, to blocking the user pass 2 and for disabling the user pass 0 | | +| status | string | User Status code. To activate the user pass 1, to block the user pass 2 and for disabling the user pass 0 | | diff --git a/app/sdks/php/src/Appwrite/Client.php b/app/sdks/php/src/Appwrite/Client.php index da9f3dbe6..95f634241 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.12', + 'x-sdk-version' => 'appwrite:php:1.0.14', ]; /** diff --git a/app/sdks/php/src/Appwrite/Services/Database.php b/app/sdks/php/src/Appwrite/Services/Database.php index 899f19360..8e7ef4344 100644 --- a/app/sdks/php/src/Appwrite/Services/Database.php +++ b/app/sdks/php/src/Appwrite/Services/Database.php @@ -191,7 +191,7 @@ class Database extends Service * @throws Exception * @return array */ - public function createDocument(string $collectionId, string $data, array $read = [], array $write = [], string $parentDocument = '', string $parentProperty = '', string $parentPropertyType = 'assign'):array + public function createDocument(string $collectionId, string $data, array $read, array $write, string $parentDocument = '', string $parentProperty = '', string $parentPropertyType = 'assign'):array { $path = str_replace(['{collectionId}'], [$collectionId], '/database/{collectionId}/documents'); $params = []; @@ -241,7 +241,7 @@ class Database extends Service * @throws Exception * @return array */ - public function updateDocument(string $collectionId, string $documentId, string $data, array $read = [], array $write = []):array + public function updateDocument(string $collectionId, string $documentId, string $data, array $read, array $write):array { $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/{collectionId}/documents/{documentId}'); $params = []; diff --git a/app/sdks/php/src/Appwrite/Services/Locale.php b/app/sdks/php/src/Appwrite/Services/Locale.php index d7b11169a..c2e5e0ec1 100644 --- a/app/sdks/php/src/Appwrite/Services/Locale.php +++ b/app/sdks/php/src/Appwrite/Services/Locale.php @@ -13,7 +13,7 @@ class Locale extends Service * * Get the current user location based on IP. Returns an object with user * country code, country name, continent name, continent code, ip address and - * suggested currency. You can use the locale header to get the data in + * suggested currency. You can use the locale header to get the data in a * supported language. * * @throws Exception @@ -33,7 +33,27 @@ class Locale extends Service /** * List Countries * - * List of all countries. You can use the locale header to get the data in + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return array + */ + public function getContinents():array + { + $path = str_replace([], [], '/locale/continents'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a * supported language. * * @throws Exception @@ -54,7 +74,7 @@ class Locale extends Service * List EU Countries * * List of all countries that are currently members of the EU. You can use the - * locale header to get the data in supported language. UK brexit date is + * locale header to get the data in a supported language. UK brexit date is * currently set to 2019-10-31 and will be updated if and when needed. * * @throws Exception @@ -75,7 +95,7 @@ class Locale extends Service * List Countries Phone Codes * * List of all countries phone codes. You can use the locale header to get the - * data in supported language. + * data in a supported language. * * @throws Exception * @return array @@ -96,7 +116,7 @@ class Locale extends Service * * 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 - * get the data in supported language. + * get the data in a supported language. * * @throws Exception * @return array diff --git a/app/sdks/php/src/Appwrite/Services/Storage.php b/app/sdks/php/src/Appwrite/Services/Storage.php index 0997850e8..9773976ef 100644 --- a/app/sdks/php/src/Appwrite/Services/Storage.php +++ b/app/sdks/php/src/Appwrite/Services/Storage.php @@ -100,7 +100,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function updateFile(string $fileId, array $read = [], array $write = [], string $folderId = ''):array + public function updateFile(string $fileId, array $read, array $write, string $folderId = ''):array { $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); $params = []; diff --git a/app/sdks/python/appwrite/client.py b/app/sdks/python/appwrite/client.py index 835c3ba01..c296e735e 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.0', + 'x-sdk-version': 'appwrite:python:1.0.2', } 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 0896879c2..e94b81d19 100644 --- a/app/sdks/python/appwrite/services/database.py +++ b/app/sdks/python/appwrite/services/database.py @@ -92,9 +92,7 @@ class Database(Service): 'content-type': 'application/json', }, params) - def create_document(self, collection_id, data, readstring(4) ""[]"" -=[], writestring(4) ""[]"" -=[], parent_document='', parent_property='', parent_property_type='assign'): + def create_document(self, collection_id, data, read, write, parent_document='', parent_property='', parent_property_type='assign'): """Create Document""" params = {} @@ -123,9 +121,7 @@ class Database(Service): 'content-type': 'application/json', }, params) - def update_document(self, collection_id, document_id, data, readstring(4) ""[]"" -=[], writestring(4) ""[]"" -=[]): + def update_document(self, collection_id, document_id, data, read, write): """Update Document""" params = {} diff --git a/app/sdks/python/appwrite/services/locale.py b/app/sdks/python/appwrite/services/locale.py index 9f128d226..514d38e1a 100644 --- a/app/sdks/python/appwrite/services/locale.py +++ b/app/sdks/python/appwrite/services/locale.py @@ -13,6 +13,16 @@ class Locale(Service): 'content-type': 'application/json', }, params) + def get_continents(self): + """List Countries""" + + params = {} + path = '/locale/continents' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + def get_countries(self): """List Countries""" diff --git a/app/sdks/python/appwrite/services/storage.py b/app/sdks/python/appwrite/services/storage.py index c1213a4a7..ab7cddd2a 100644 --- a/app/sdks/python/appwrite/services/storage.py +++ b/app/sdks/python/appwrite/services/storage.py @@ -44,9 +44,7 @@ class Storage(Service): 'content-type': 'application/json', }, params) - def update_file(self, file_id, readstring(4) ""[]"" -=[], writestring(4) ""[]"" -=[], folder_id=''): + def update_file(self, file_id, read, write, folder_id=''): """Update File""" params = {} diff --git a/app/sdks/python/setup.py b/app/sdks/python/setup.py index 055dd5ad5..9b5f69c64 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.0', + version = '1.0.2', 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.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/1.0.2.tar.gz', # keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], install_requires=[ 'requests', diff --git a/app/sdks/ruby/appwrite.gemspec b/app/sdks/ruby/appwrite.gemspec index 8af49735a..68d58653f 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.4' + s.version = '1.0.6' 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 83b78f5e8..eb1352fbc 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.4' + 'x-sdk-version' => 'appwrite:ruby:1.0.6' } @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 09ed2b592..b3483ab9e 100644 --- a/app/sdks/ruby/lib/appwrite/services/database.rb +++ b/app/sdks/ruby/lib/appwrite/services/database.rb @@ -92,7 +92,7 @@ module Appwrite }, params); end - def create_document(collection_id:, data:, read: [], write: [], parent_document: '', parent_property: '', parent_property_type: 'assign') + def create_document(collection_id:, data:, read:, write:, parent_document: '', parent_property: '', parent_property_type: 'assign') path = '/database/{collectionId}/documents' .gsub('{collection_id}', collection_id) @@ -123,7 +123,7 @@ module Appwrite }, params); end - def update_document(collection_id:, document_id:, data:, read: [], write: []) + def update_document(collection_id:, document_id:, data:, read:, write:) path = '/database/{collectionId}/documents/{documentId}' .gsub('{collection_id}', collection_id) .gsub('{document_id}', document_id) diff --git a/app/sdks/ruby/lib/appwrite/services/locale.rb b/app/sdks/ruby/lib/appwrite/services/locale.rb index 32014659b..a5c708c76 100644 --- a/app/sdks/ruby/lib/appwrite/services/locale.rb +++ b/app/sdks/ruby/lib/appwrite/services/locale.rb @@ -12,6 +12,17 @@ module Appwrite }, params); end + def get_continents() + path = '/locale/continents' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + def get_countries() path = '/locale/countries' diff --git a/app/sdks/ruby/lib/appwrite/services/storage.rb b/app/sdks/ruby/lib/appwrite/services/storage.rb index 130c1bc8a..902a9dcf6 100644 --- a/app/sdks/ruby/lib/appwrite/services/storage.rb +++ b/app/sdks/ruby/lib/appwrite/services/storage.rb @@ -43,7 +43,7 @@ module Appwrite }, params); end - def update_file(file_id:, read: [], write: [], folder_id: '') + def update_file(file_id:, read:, write:, folder_id: '') path = '/storage/files/{fileId}' .gsub('{file_id}', file_id) diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index af19f3c73..d29e64bf6 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -39,7 +39,7 @@ $cli $clients = [ 'php' => [ - 'version' => '1.0.13', + 'version' => '1.0.14', '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.25', + 'version' => '1.0.26', '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.28', + 'version' => '1.0.29', '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.1', + 'version' => '1.0.2', '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.5', + 'version' => '1.0.6', '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.3', + 'version' => '0.0.4', '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.2', + 'version' => '0.0.3', 'result' => __DIR__.'/../sdks/go/', 'gitURL' => 'https://github.com/appwrite/sdk-for-go', 'gitRepo' => 'git@github.com:appwrite/sdk-for-go.git',