Updated SDK examples

This commit is contained in:
Eldad Fux committed 2020-01-30 18:18:59 +02:00
1 parent 1beaa237f0
commit d03840bb05
240 files changed
+6299 -1430

No files matched your search

+10 -10
View File
@@ -10,7 +10,7 @@ class Database(Service):
"""List Collections"""
params = {}
path = '/database'
path = '/database/collections'
params['search'] = search
params['limit'] = limit
params['offset'] = offset
@@ -24,7 +24,7 @@ class Database(Service):
"""Create Collection"""
params = {}
path = '/database'
path = '/database/collections'
params['name'] = name
params['read'] = read
params['write'] = write
@@ -38,7 +38,7 @@ class Database(Service):
"""Get Collection"""
params = {}
path = '/database/{collectionId}'
path = '/database/collections/{collectionId}'
path = path.replace('{collectionId}', collection_id)
return self.client.call('get', path, {
@@ -49,7 +49,7 @@ class Database(Service):
"""Update Collection"""
params = {}
path = '/database/{collectionId}'
path = '/database/collections/{collectionId}'
path = path.replace('{collectionId}', collection_id)
params['name'] = name
params['read'] = read
@@ -64,7 +64,7 @@ class Database(Service):
"""Delete Collection"""
params = {}
path = '/database/{collectionId}'
path = '/database/collections/{collectionId}'
path = path.replace('{collectionId}', collection_id)
return self.client.call('delete', path, {
@@ -75,7 +75,7 @@ class Database(Service):
"""List Documents"""
params = {}
path = '/database/{collectionId}/documents'
path = '/database/collections/{collectionId}/documents'
path = path.replace('{collectionId}', collection_id)
params['filters'] = filters
params['offset'] = offset
@@ -95,7 +95,7 @@ class Database(Service):
"""Create Document"""
params = {}
path = '/database/{collectionId}/documents'
path = '/database/collections/{collectionId}/documents'
path = path.replace('{collectionId}', collection_id)
params['data'] = data
params['read'] = read
@@ -112,7 +112,7 @@ class Database(Service):
"""Get Document"""
params = {}
path = '/database/{collectionId}/documents/{documentId}'
path = '/database/collections/{collectionId}/documents/{documentId}'
path = path.replace('{collectionId}', collection_id)
path = path.replace('{documentId}', document_id)
@@ -124,7 +124,7 @@ class Database(Service):
"""Update Document"""
params = {}
path = '/database/{collectionId}/documents/{documentId}'
path = '/database/collections/{collectionId}/documents/{documentId}'
path = path.replace('{collectionId}', collection_id)
path = path.replace('{documentId}', document_id)
params['data'] = data
@@ -139,7 +139,7 @@ class Database(Service):
"""Delete Document"""
params = {}
path = '/database/{collectionId}/documents/{documentId}'
path = '/database/collections/{collectionId}/documents/{documentId}'
path = path.replace('{collectionId}', collection_id)
path = path.replace('{documentId}', document_id)
+1 -1
View File
@@ -6,7 +6,7 @@ class Locale(Service):
def __init__(self, client):
super(Locale, self).__init__(client)
def get_locale(self):
def get(self):
"""Get User Locale"""
params = {}
+8 -8
View File
@@ -6,7 +6,7 @@ class Storage(Service):
def __init__(self, client):
super(Storage, self).__init__(client)
def list_files(self, search='', limit=25, offset=0, order_type='ASC'):
def list(self, search='', limit=25, offset=0, order_type='ASC'):
"""List Files"""
params = {}
@@ -20,7 +20,7 @@ class Storage(Service):
'content-type': 'application/json',
}, params)
def create_file(self, file, read, write):
def create(self, file, read, write):
"""Create File"""
params = {}
@@ -33,7 +33,7 @@ class Storage(Service):
'content-type': 'multipart/form-data',
}, params)
def get_file(self, file_id):
def get(self, file_id):
"""Get File"""
params = {}
@@ -44,7 +44,7 @@ class Storage(Service):
'content-type': 'application/json',
}, params)
def update_file(self, file_id, read, write):
def update(self, file_id, read, write):
"""Update File"""
params = {}
@@ -57,7 +57,7 @@ class Storage(Service):
'content-type': 'application/json',
}, params)
def delete_file(self, file_id):
def delete(self, file_id):
"""Delete File"""
params = {}
@@ -68,7 +68,7 @@ class Storage(Service):
'content-type': 'application/json',
}, params)
def get_file_download(self, file_id):
def get_download(self, file_id):
"""Get File for Download"""
params = {}
@@ -79,7 +79,7 @@ class Storage(Service):
'content-type': 'application/json',
}, params)
def get_file_preview(self, file_id, width=0, height=0, quality=100, background='', output=''):
def get_preview(self, file_id, width=0, height=0, quality=100, background='', output=''):
"""Get File Preview"""
params = {}
@@ -95,7 +95,7 @@ class Storage(Service):
'content-type': 'application/json',
}, params)
def get_file_view(self, file_id, xas=''):
def get_view(self, file_id, xas=''):
"""Get File for View"""
params = {}
+8 -8
View File
@@ -6,7 +6,7 @@ class Teams(Service):
def __init__(self, client):
super(Teams, self).__init__(client)
def list_teams(self, search='', limit=25, offset=0, order_type='ASC'):
def list(self, search='', limit=25, offset=0, order_type='ASC'):
"""List Teams"""
params = {}
@@ -20,7 +20,7 @@ class Teams(Service):
'content-type': 'application/json',
}, params)
def create_team(self, name, roles=[]):
def create(self, name, roles=[]):
"""Create Team"""
params = {}
@@ -32,7 +32,7 @@ class Teams(Service):
'content-type': 'application/json',
}, params)
def get_team(self, team_id):
def get(self, team_id):
"""Get Team"""
params = {}
@@ -43,7 +43,7 @@ class Teams(Service):
'content-type': 'application/json',
}, params)
def update_team(self, team_id, name):
def update(self, team_id, name):
"""Update Team"""
params = {}
@@ -55,7 +55,7 @@ class Teams(Service):
'content-type': 'application/json',
}, params)
def delete_team(self, team_id):
def delete(self, team_id):
"""Delete Team"""
params = {}
@@ -66,7 +66,7 @@ class Teams(Service):
'content-type': 'application/json',
}, params)
def get_team_memberships(self, team_id):
def get_memberships(self, team_id):
"""Get Team Memberships"""
params = {}
@@ -77,7 +77,7 @@ class Teams(Service):
'content-type': 'application/json',
}, params)
def create_team_membership(self, team_id, email, roles, url, name=''):
def create_membership(self, team_id, email, roles, url, name=''):
"""Create Team Membership"""
params = {}
@@ -92,7 +92,7 @@ class Teams(Service):
'content-type': 'application/json',
}, params)
def delete_team_membership(self, team_id, invite_id):
def delete_membership(self, team_id, invite_id):
"""Delete Team Membership"""
params = {}
+10 -10
View File
@@ -6,7 +6,7 @@ class Users(Service):
def __init__(self, client):
super(Users, self).__init__(client)
def list_users(self, search='', limit=25, offset=0, order_type='ASC'):
def list(self, search='', limit=25, offset=0, order_type='ASC'):
"""List Users"""
params = {}
@@ -20,7 +20,7 @@ class Users(Service):
'content-type': 'application/json',
}, params)
def create_user(self, email, password, name=''):
def create(self, email, password, name=''):
"""Create User"""
params = {}
@@ -33,7 +33,7 @@ class Users(Service):
'content-type': 'application/json',
}, params)
def get_user(self, user_id):
def get(self, user_id):
"""Get User"""
params = {}
@@ -44,7 +44,7 @@ class Users(Service):
'content-type': 'application/json',
}, params)
def get_user_logs(self, user_id):
def get_logs(self, user_id):
"""Get User Logs"""
params = {}
@@ -55,7 +55,7 @@ class Users(Service):
'content-type': 'application/json',
}, params)
def get_user_prefs(self, user_id):
def get_prefs(self, user_id):
"""Get User Preferences"""
params = {}
@@ -66,7 +66,7 @@ class Users(Service):
'content-type': 'application/json',
}, params)
def update_user_prefs(self, user_id, prefs):
def update_prefs(self, user_id, prefs):
"""Update User Preferences"""
params = {}
@@ -78,7 +78,7 @@ class Users(Service):
'content-type': 'application/json',
}, params)
def get_user_sessions(self, user_id):
def get_sessions(self, user_id):
"""Get User Sessions"""
params = {}
@@ -89,7 +89,7 @@ class Users(Service):
'content-type': 'application/json',
}, params)
def delete_user_sessions(self, user_id):
def delete_sessions(self, user_id):
"""Delete User Sessions"""
params = {}
@@ -100,7 +100,7 @@ class Users(Service):
'content-type': 'application/json',
}, params)
def delete_user_session(self, user_id, session_id):
def delete_session(self, user_id, session_id):
"""Delete User Session"""
params = {}
@@ -112,7 +112,7 @@ class Users(Service):
'content-type': 'application/json',
}, params)
def update_user_status(self, user_id, status):
def update_status(self, user_id, status):
"""Update User Status"""
params = {}
@@ -10,4 +10,4 @@ client = Client()
locale = Locale(client)
result = locale.get_locale()
result = locale.get()
@@ -1,13 +0,0 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('')
.set_key('')
)
storage = Storage(client)
result = storage.create_file(document.getElementById('uploader').files[0], {}, {})
@@ -10,4 +10,4 @@ client = Client()
storage = Storage(client)
result = storage.get_file_preview('[FILE_ID]')
result = storage.create(document.getElementById('uploader').files[0], {}, {})
@@ -10,4 +10,4 @@ client = Client()
storage = Storage(client)
result = storage.get_file('[FILE_ID]')
result = storage.delete('[FILE_ID]')
@@ -10,4 +10,4 @@ client = Client()
storage = Storage(client)
result = storage.get_file_view('[FILE_ID]')
result = storage.get_download('[FILE_ID]')
@@ -1,13 +0,0 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('')
.set_key('')
)
storage = Storage(client)
result = storage.get_file_download('[FILE_ID]')
@@ -10,4 +10,4 @@ client = Client()
storage = Storage(client)
result = storage.delete_file('[FILE_ID]')
result = storage.get_preview('[FILE_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('')
.set_key('')
)
storage = Storage(client)
result = storage.get_view('[FILE_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('')
.set_key('')
)
storage = Storage(client)
result = storage.get('[FILE_ID]')
@@ -10,4 +10,4 @@ client = Client()
storage = Storage(client)
result = storage.list_files()
result = storage.list()
@@ -1,13 +0,0 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('')
.set_key('')
)
storage = Storage(client)
result = storage.update_file('[FILE_ID]', {}, {})
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('')
.set_key('')
)
storage = Storage(client)
result = storage.update('[FILE_ID]', {}, {})
@@ -10,4 +10,4 @@ client = Client()
teams = Teams(client)
result = teams.delete_team_membership('[TEAM_ID]', '[INVITE_ID]')
result = teams.create_membership('[TEAM_ID]', 'email@example.com', {}, 'https://example.com')
@@ -1,13 +0,0 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('')
.set_key('')
)
teams = Teams(client)
result = teams.create_team_membership('[TEAM_ID]', 'email@example.com', {}, 'https://example.com')
@@ -10,4 +10,4 @@ client = Client()
teams = Teams(client)
result = teams.create_team('[NAME]')
result = teams.create('[NAME]')
@@ -10,4 +10,4 @@ client = Client()
teams = Teams(client)
result = teams.get_team_memberships('[TEAM_ID]')
result = teams.delete_membership('[TEAM_ID]', '[INVITE_ID]')
@@ -10,4 +10,4 @@ client = Client()
teams = Teams(client)
result = teams.get_team('[TEAM_ID]')
result = teams.delete('[TEAM_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('')
.set_key('')
)
teams = Teams(client)
result = teams.get_memberships('[TEAM_ID]')
@@ -10,4 +10,4 @@ client = Client()
teams = Teams(client)
result = teams.delete_team('[TEAM_ID]')
result = teams.get('[TEAM_ID]')
@@ -10,4 +10,4 @@ client = Client()
teams = Teams(client)
result = teams.list_teams()
result = teams.list()
@@ -1,13 +0,0 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('')
.set_key('')
)
teams = Teams(client)
result = teams.update_team('[TEAM_ID]', '[NAME]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('')
.set_key('')
)
teams = Teams(client)
result = teams.update('[TEAM_ID]', '[NAME]')
@@ -1,13 +0,0 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('')
.set_key('')
)
users = Users(client)
result = users.create_user('email@example.com', 'password')
@@ -10,4 +10,4 @@ client = Client()
users = Users(client)
result = users.delete_user_sessions('[USER_ID]')
result = users.create('email@example.com', 'password')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('')
.set_key('')
)
users = Users(client)
result = users.delete_session('[USER_ID]', '[SESSION_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('')
.set_key('')
)
users = Users(client)
result = users.delete_sessions('[USER_ID]')
@@ -1,13 +0,0 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('')
.set_key('')
)
users = Users(client)
result = users.delete_user_session('[USER_ID]', '[SESSION_ID]')
@@ -10,4 +10,4 @@ client = Client()
users = Users(client)
result = users.get_user('[USER_ID]')
result = users.get_logs('[USER_ID]')
@@ -10,4 +10,4 @@ client = Client()
users = Users(client)
result = users.get_user_logs('[USER_ID]')
result = users.get_prefs('[USER_ID]')
@@ -10,4 +10,4 @@ client = Client()
users = Users(client)
result = users.get_user_prefs('[USER_ID]')
result = users.get_sessions('[USER_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('')
.set_key('')
)
users = Users(client)
result = users.get('[USER_ID]')
@@ -10,4 +10,4 @@ client = Client()
users = Users(client)
result = users.list_users()
result = users.list()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('')
.set_key('')
)
users = Users(client)
result = users.update_prefs('[USER_ID]', '')
@@ -10,4 +10,4 @@ client = Client()
users = Users(client)
result = users.get_user_sessions('[USER_ID]')
result = users.update_status('[USER_ID]', '1')
@@ -1,13 +0,0 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('')
.set_key('')
)
users = Users(client)
result = users.update_user_prefs('[USER_ID]', '')
@@ -1,13 +0,0 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('')
.set_key('')
)
users = Users(client)
result = users.update_user_status('[USER_ID]', '1')