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 20:15:27 +03:00
parent 5819fc8d7b
commit 5c6ab78064
54 changed files with 320 additions and 105 deletions

View file

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

View file

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

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.2',
'x-sdk-version': 'appwrite:dart:0.0.4',
};
this.selfSigned = false;

View file

@ -90,7 +90,7 @@ class Database extends Service {
return await this.client.call('get', path: path, params: params);
}
/// Create a new Document.
Future<Response> createDocument({collectionId, data, read = const [], write = const [], parentDocument = null, parentProperty = null, parentPropertyType = 'assign'}) async {
Future<Response> createDocument({collectionId, data, read, write, parentDocument = null, parentProperty = null, parentPropertyType = 'assign'}) async {
String path = '/database/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId);
Map<String, dynamic> params = {
@ -114,7 +114,7 @@ class Database extends Service {
return await this.client.call('get', path: path, params: params);
}
Future<Response> updateDocument({collectionId, documentId, data, read = const [], write = const []}) async {
Future<Response> updateDocument({collectionId, documentId, data, read, write}) async {
String path = '/database/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId);
Map<String, dynamic> params = {

View file

@ -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<Response> 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<Response> getContinents() async {
String path = '/locale/continents';
Map<String, dynamic> 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<Response> 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<Response> 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<Response> 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<Response> getCurrencies() async {
String path = '/locale/currencies';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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.24",
"version": "1.0.26",
"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.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 = {};

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.24');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.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')}
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)}
@ -115,8 +115,10 @@ if(orderCast){payload['order-cast']=orderCast}
if(search){payload.search=search}
if(first){payload.first=first}
if(last){payload.last=last}
return http.get(path,{'content-type':'application/json',},payload)},createDocument:function(collectionId,data,read=[],write=[],parentDocument='',parentProperty='',parentPropertyType='assign'){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
return http.get(path,{'content-type':'application/json',},payload)},createDocument:function(collectionId,data,read,write,parentDocument='',parentProperty='',parentPropertyType='assign'){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
if(data===undefined){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={};if(data){payload.data=data}
if(read){payload.read=read}
if(write){payload.write=write}
@ -125,15 +127,17 @@ if(parentProperty){payload.parentProperty=parentProperty}
if(parentPropertyType){payload.parentPropertyType=parentPropertyType}
return http.post(path,{'content-type':'application/json',},payload)},getDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')}
let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateDocument:function(collectionId,documentId,data,read=[],write=[]){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateDocument:function(collectionId,documentId,data,read,write){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')}
if(data===undefined){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={};if(data){payload.data=data}
if(read){payload.read=read}
if(write){payload.write=write}
return http.patch(path,{'content-type':'application/json',},payload)},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')}
let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)}};let locale={getLocale:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let projects={listProjects:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createProject:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"')}
let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)}};let locale={getLocale:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let projects={listProjects:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createProject:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"')}
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')}
let path='/projects';let payload={};if(name){payload.name=name}
if(teamId){payload.teamId=teamId}
@ -278,7 +282,9 @@ if(read){payload.read=read}
if(write){payload.write=write}
if(folderId){payload.folderId=folderId}
return http.post(path,{'content-type':'multipart/form-data',},payload)},getFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateFile:function(fileId,read=[],write=[],folderId=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},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={};if(read){payload.read=read}
if(write){payload.write=write}
if(folderId){payload.folderId=folderId}

View file

@ -3,7 +3,7 @@
![License](https://img.shields.io/github/license/appwrite/sdk-for-node.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)

View file

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

View file

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

View file

@ -0,0 +1,19 @@
const sdk = require('node-appwrite');
// Init SDK
let client = new sdk.Client();
let locale = new sdk.Locale(client);
client
.setProject('')
.setKey('')
;
let promise = locale.getContinents();
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -10,7 +10,7 @@ client
.setKey('')
;
let promise = storage.updateFile('[FILE_ID]');
let promise = storage.updateFile('[FILE_ID]', [], []);
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.27',
'x-sdk-version': 'appwrite:nodejs:1.0.29',
};
this.selfSigned = false;
}

View file

@ -179,7 +179,7 @@ class Database extends Service {
* @throws Exception
* @return {}
*/
async createDocument(collectionId, data, read = [], write = [], parentDocument = '', parentProperty = '', parentPropertyType = 'assign') {
async createDocument(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') {
let path = '/database/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId);
return await this.client.call('post', path, {
@ -227,7 +227,7 @@ class Database extends Service {
* @throws Exception
* @return {}
*/
async updateDocument(collectionId, documentId, data, read = [], write = []) {
async updateDocument(collectionId, documentId, data, read, write) {
let path = '/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId);
return await this.client.call('patch', path, {

View file

@ -7,7 +7,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
@ -26,7 +26,26 @@ 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 {}
*/
async getContinents() {
let path = '/locale/continents';
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
}
/**
* List Countries
*
* List of all countries. You can use the locale header to get the data in a
* supported language.
*
* @throws Exception
@ -46,7 +65,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
@ -66,7 +85,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 {}
@ -86,7 +105,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 {}

View file

@ -91,7 +91,7 @@ class Storage extends Service {
* @throws Exception
* @return {}
*/
async updateFile(fileId, read = [], write = [], folderId = '') {
async updateFile(fileId, read, write, folderId = '') {
let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId);
return await this.client.call('put', 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.27",
"version": "1.0.29",
"license": "BSD-3-Clause",
"main": "index.js",
"repository": {

View file

@ -3,7 +3,7 @@
![License](https://img.shields.io/github/license/appwrite/sdk-for-php.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)

View file

@ -30,8 +30,8 @@ POST https://appwrite.io/v1/database
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| 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 | |
## Get Collection
@ -117,8 +117,8 @@ POST https://appwrite.io/v1/database/{collectionId}/documents
| --- | --- | --- | --- |
| collectionId | string | **Required** Collection unique ID. | |
| data | string | Document data as JSON string. | |
| 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. | |
| parentDocument | string | Parent document unique ID. Use when you want your new document to be a child of a parent document. | |
| parentProperty | string | Parent document property name. Use when you want your new document to be a child of a parent document. | |
| parentPropertyType | string | Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document. | assign |
@ -151,8 +151,8 @@ PATCH https://appwrite.io/v1/database/{collectionId}/documents/{documentId}
| collectionId | string | **Required** Collection unique ID | |
| documentId | string | **Required** Document unique ID | |
| data | string | Document data as JSON string | |
| 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. | |
## Delete Document

View file

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

View file

@ -12,4 +12,4 @@ $client
$database = new Database($client);
$result = $database->updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', '{}');
$result = $database->updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', '{}', [], []);

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Locale;
$client = new Client();
$client
->setProject('')
->setKey('')
;
$locale = new Locale($client);
$result = $locale->getContinents();

View file

@ -12,4 +12,4 @@ $client
$storage = new Storage($client);
$result = $storage->updateFile('[FILE_ID]');
$result = $storage->updateFile('[FILE_ID]', [], []);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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.0',
'x-sdk-version': 'appwrite:python:1.0.2',
}
def set_self_signed(self, status=True):

View file

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

View file

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

View file

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

View file

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

View file

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

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.4'
'x-sdk-version' => 'appwrite:ruby:1.0.6'
}
@endpoint = 'https://appwrite.io/v1';
end

View file

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

View file

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

View file

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

View file

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