1
0
Fork 0
mirror of synced 2024-06-28 11:10:46 +12:00

Updated SDKs

This commit is contained in:
eldadfux 2019-10-21 21:03:06 +03:00
parent 713f8a22f0
commit 3937e10a1d
36 changed files with 69 additions and 53 deletions

View file

@ -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/

View file

@ -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:

View file

@ -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;

View file

@ -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<Response> updateCollection({collectionId, name, read = const [], write = const [], rules = const []}) async {
Future<Response> updateCollection({collectionId, name, read, write, rules = const []}) async {
String path = '/database/{collectionId}'.replaceAll(RegExp('{collectionId}'), collectionId);
Map<String, dynamic> params = {

View file

@ -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<Response> createFile({files, read = const [], write = const [], folderId = null}) async {
Future<Response> createFile({files, read, write, folderId = null}) async {
String path = '/storage/files';
Map<String, dynamic> params = {

View file

@ -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 <team@appwrite.io>
homepage: https://github.com/appwrite/sdk-for-dart

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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 <body> tag, but before you use any Appwrite services:
```html
<script src="https://cdn.jsdelivr.net/npm/appwrite@1.0.26"></script>
<script src="https://cdn.jsdelivr.net/npm/appwrite@1.0.27"></script>
```
## Getting Started

View file

@ -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);

View file

@ -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);

View file

@ -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": {

View file

@ -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 = {};

View file

@ -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=/(?:\?|&amp;|&)+([^=]+)(?:=([^&]*))*/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;index<params[p].length;index++){let param=params[p][index];str.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{str.push(encodeURIComponent(p)+"="+encodeURIComponent(params[p]))}}
return str.join("&")};let addGlobalHeader=function(key,value){globalHeaders[key]={key:key.toLowerCase(),value:value.toLowerCase()}};let addGlobalParam=function(key,value){globalParams.push({key:key,value:value})};addGlobalHeader('x-sdk-version','appwrite:javascript:1.0.26');addGlobalHeader('content-type','');let call=function(method,path,headers={},params={},progress=null){let i;path=config.endpoint+path;if(-1===['GET','POST','PUT','DELETE','TRACE','HEAD','OPTIONS','CONNECT','PATCH'].indexOf(method)){throw new Error('var method must contain a valid HTTP method name')}
return str.join("&")};let addGlobalHeader=function(key,value){globalHeaders[key]={key:key.toLowerCase(),value:value.toLowerCase()}};let addGlobalParam=function(key,value){globalParams.push({key:key,value:value})};addGlobalHeader('x-sdk-version','appwrite:javascript:1.0.27');addGlobalHeader('content-type','');let call=function(method,path,headers={},params={},progress=null){let i;path=config.endpoint+path;if(-1===['GET','POST','PUT','DELETE','TRACE','HEAD','OPTIONS','CONNECT','PATCH'].indexOf(method)){throw new Error('var method must contain a valid HTTP method name')}
if(typeof path!=='string'){throw new Error('var path must be of type string')}
if(typeof headers!=='object'){throw new Error('var headers must be of type object')}
for(i=0;i<globalParams.length;i++){path=addParam(path,globalParams[i].key,globalParams[i].value)}
@ -98,8 +98,10 @@ if(read){payload.read=read}
if(write){payload.write=write}
if(rules){payload.rules=rules}
return http.post(path,{'content-type':'application/json',},payload)},getCollection:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
let path='/database/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateCollection:function(collectionId,name,read=[],write=[],rules=[]){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
let path='/database/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateCollection:function(collectionId,name,read,write,rules=[]){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
if(name===undefined){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={};if(name){payload.name=name}
if(read){payload.read=read}
if(write){payload.write=write}
@ -276,7 +278,9 @@ let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{proje
if(limit){payload.limit=limit}
if(offset){payload.offset=offset}
if(orderType){payload.orderType=orderType}
return http.get(path,{'content-type':'application/json',},payload)},createFile:function(files,read=[],write=[],folderId=''){if(files===undefined){throw new Error('Missing required parameter: "files"')}
return http.get(path,{'content-type':'application/json',},payload)},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={};if(files){payload.files=files}
if(read){payload.read=read}
if(write){payload.write=write}

View file

@ -10,7 +10,7 @@ client
.setKey('')
;
let promise = database.updateCollection('[COLLECTION_ID]', '[NAME]');
let promise = database.updateCollection('[COLLECTION_ID]', '[NAME]', [], []);
promise.then(function (response) {
console.log(response);

View file

@ -10,7 +10,7 @@ client
.setKey('')
;
let promise = storage.createFile(document.getElementById('uploader').files[0]);
let promise = storage.createFile(document.getElementById('uploader').files[0], [], []);
promise.then(function (response) {
console.log(response);

View file

@ -7,7 +7,7 @@ class Client {
this.endpoint = 'https://appwrite.io/v1';
this.headers = {
'content-type': '',
'x-sdk-version': 'appwrite:nodejs:1.0.29',
'x-sdk-version': 'appwrite:nodejs:1.0.30',
};
this.selfSigned = false;
}

View file

@ -90,7 +90,7 @@ class Database extends Service {
* @throws Exception
* @return {}
*/
async updateCollection(collectionId, name, read = [], write = [], rules = []) {
async updateCollection(collectionId, name, read, write, rules = []) {
let path = '/database/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId);
return await this.client.call('put', path, {

View file

@ -44,7 +44,7 @@ class Storage extends Service {
* @throws Exception
* @return {}
*/
async createFile(files, read = [], write = [], folderId = '') {
async createFile(files, read, write, folderId = '') {
let path = '/storage/files';
return await this.client.call('post', path, {

View file

@ -2,7 +2,7 @@
"name": "node-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.29",
"version": "1.0.30",
"license": "BSD-3-Clause",
"main": "index.js",
"repository": {

View file

@ -62,8 +62,8 @@ PUT https://appwrite.io/v1/database/{collectionId}
| --- | --- | --- | --- |
| collectionId | string | **Required** Collection unique ID. | |
| name | string | Collection name. | |
| 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. | |
| rules | array | Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation | [] |
## Delete Collection

View file

@ -12,4 +12,4 @@ $client
$database = new Database($client);
$result = $database->updateCollection('[COLLECTION_ID]', '[NAME]');
$result = $database->updateCollection('[COLLECTION_ID]', '[NAME]', [], []);

View file

@ -12,4 +12,4 @@ $client
$storage = new Storage($client);
$result = $storage->createFile(new \CURLFile('/path/to/file.png', 'image/png', 'file.png'));
$result = $storage->createFile(new \CURLFile('/path/to/file.png', 'image/png', 'file.png'), [], []);

View file

@ -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

View file

@ -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',
];
/**

View file

@ -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 = [];

View file

@ -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 = [];

View file

@ -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):

View file

@ -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"""

View file

@ -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 = {}

View file

@ -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',

View file

@ -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'

View file

@ -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

View file

@ -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)

View file

@ -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 = {

View file

@ -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',