Skip to content

Commit

Permalink
feat: release 1.4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenDittmann committed Aug 30, 2023
1 parent 44f2d3e commit f24f9b2
Show file tree
Hide file tree
Showing 38 changed files with 960 additions and 349 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Appwrite Python SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.3.2-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.4.0-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**

Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)

Expand Down
6 changes: 3 additions & 3 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def __init__(self):
self._endpoint = 'https://HOSTNAME/v1'
self._global_headers = {
'content-type': '',
'user-agent' : 'AppwritePythonSDK/2.0.2 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
'user-agent' : 'AppwritePythonSDK/3.0.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '2.0.2',
'X-Appwrite-Response-Format' : '1.0.0',
'x-sdk-version': '3.0.0',
'X-Appwrite-Response-Format' : '1.4.0',
}

def set_self_signed(self, status=True):
Expand Down
109 changes: 69 additions & 40 deletions appwrite/services/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ def get(self):
"""Get Account"""


path = '/account'
api_path = '/account'
params = {}

return self.client.call('get', path, {
return self.client.call('get', api_path, {
'content-type': 'application/json',
}, params)

def update_email(self, email, password):
"""Update Email"""


path = '/account/email'
api_path = '/account/email'
params = {}
if email is None:
raise AppwriteException('Missing required parameter: "email"')
Expand All @@ -33,44 +33,73 @@ def update_email(self, email, password):
params['email'] = email
params['password'] = password

return self.client.call('patch', path, {
return self.client.call('patch', api_path, {
'content-type': 'application/json',
}, params)

def list_identities(self, queries = None):
"""List Identities"""


api_path = '/account/identities'
params = {}

params['queries'] = queries

return self.client.call('get', api_path, {
'content-type': 'application/json',
}, params)

def delete_identity(self, identity_id):
"""Delete Identity"""


api_path = '/account/identities/{identityId}'
params = {}
if identity_id is None:
raise AppwriteException('Missing required parameter: "identity_id"')

path = path.replace('{identityId}', identity_id)


return self.client.call('delete', api_path, {
'content-type': 'application/json',
}, params)

def list_logs(self, queries = None):
"""List Logs"""


path = '/account/logs'
api_path = '/account/logs'
params = {}

params['queries'] = queries

return self.client.call('get', path, {
return self.client.call('get', api_path, {
'content-type': 'application/json',
}, params)

def update_name(self, name):
"""Update Name"""


path = '/account/name'
api_path = '/account/name'
params = {}
if name is None:
raise AppwriteException('Missing required parameter: "name"')


params['name'] = name

return self.client.call('patch', path, {
return self.client.call('patch', api_path, {
'content-type': 'application/json',
}, params)

def update_password(self, password, old_password = None):
"""Update Password"""


path = '/account/password'
api_path = '/account/password'
params = {}
if password is None:
raise AppwriteException('Missing required parameter: "password"')
Expand All @@ -79,15 +108,15 @@ def update_password(self, password, old_password = None):
params['password'] = password
params['oldPassword'] = old_password

return self.client.call('patch', path, {
return self.client.call('patch', api_path, {
'content-type': 'application/json',
}, params)

def update_phone(self, phone, password):
"""Update Phone"""


path = '/account/phone'
api_path = '/account/phone'
params = {}
if phone is None:
raise AppwriteException('Missing required parameter: "phone"')
Expand All @@ -99,42 +128,42 @@ def update_phone(self, phone, password):
params['phone'] = phone
params['password'] = password

return self.client.call('patch', path, {
return self.client.call('patch', api_path, {
'content-type': 'application/json',
}, params)

def get_prefs(self):
"""Get Account Preferences"""


path = '/account/prefs'
api_path = '/account/prefs'
params = {}

return self.client.call('get', path, {
return self.client.call('get', api_path, {
'content-type': 'application/json',
}, params)

def update_prefs(self, prefs):
"""Update Preferences"""


path = '/account/prefs'
api_path = '/account/prefs'
params = {}
if prefs is None:
raise AppwriteException('Missing required parameter: "prefs"')


params['prefs'] = prefs

return self.client.call('patch', path, {
return self.client.call('patch', api_path, {
'content-type': 'application/json',
}, params)

def create_recovery(self, email, url):
"""Create Password Recovery"""


path = '/account/recovery'
api_path = '/account/recovery'
params = {}
if email is None:
raise AppwriteException('Missing required parameter: "email"')
Expand All @@ -146,15 +175,15 @@ def create_recovery(self, email, url):
params['email'] = email
params['url'] = url

return self.client.call('post', path, {
return self.client.call('post', api_path, {
'content-type': 'application/json',
}, params)

def update_recovery(self, user_id, secret, password, password_again):
"""Create Password Recovery (confirmation)"""


path = '/account/recovery'
api_path = '/account/recovery'
params = {}
if user_id is None:
raise AppwriteException('Missing required parameter: "user_id"')
Expand All @@ -174,112 +203,112 @@ def update_recovery(self, user_id, secret, password, password_again):
params['password'] = password
params['passwordAgain'] = password_again

return self.client.call('put', path, {
return self.client.call('put', api_path, {
'content-type': 'application/json',
}, params)

def list_sessions(self):
"""List Sessions"""


path = '/account/sessions'
api_path = '/account/sessions'
params = {}

return self.client.call('get', path, {
return self.client.call('get', api_path, {
'content-type': 'application/json',
}, params)

def delete_sessions(self):
"""Delete Sessions"""


path = '/account/sessions'
api_path = '/account/sessions'
params = {}

return self.client.call('delete', path, {
return self.client.call('delete', api_path, {
'content-type': 'application/json',
}, params)

def get_session(self, session_id):
"""Get Session"""


path = '/account/sessions/{sessionId}'
api_path = '/account/sessions/{sessionId}'
params = {}
if session_id is None:
raise AppwriteException('Missing required parameter: "session_id"')

path = path.replace('{sessionId}', session_id)


return self.client.call('get', path, {
return self.client.call('get', api_path, {
'content-type': 'application/json',
}, params)

def update_session(self, session_id):
"""Update OAuth Session (Refresh Tokens)"""


path = '/account/sessions/{sessionId}'
api_path = '/account/sessions/{sessionId}'
params = {}
if session_id is None:
raise AppwriteException('Missing required parameter: "session_id"')

path = path.replace('{sessionId}', session_id)


return self.client.call('patch', path, {
return self.client.call('patch', api_path, {
'content-type': 'application/json',
}, params)

def delete_session(self, session_id):
"""Delete Session"""


path = '/account/sessions/{sessionId}'
api_path = '/account/sessions/{sessionId}'
params = {}
if session_id is None:
raise AppwriteException('Missing required parameter: "session_id"')

path = path.replace('{sessionId}', session_id)


return self.client.call('delete', path, {
return self.client.call('delete', api_path, {
'content-type': 'application/json',
}, params)

def update_status(self):
"""Update Status"""


path = '/account/status'
api_path = '/account/status'
params = {}

return self.client.call('patch', path, {
return self.client.call('patch', api_path, {
'content-type': 'application/json',
}, params)

def create_verification(self, url):
"""Create Email Verification"""


path = '/account/verification'
api_path = '/account/verification'
params = {}
if url is None:
raise AppwriteException('Missing required parameter: "url"')


params['url'] = url

return self.client.call('post', path, {
return self.client.call('post', api_path, {
'content-type': 'application/json',
}, params)

def update_verification(self, user_id, secret):
"""Create Email Verification (confirmation)"""


path = '/account/verification'
api_path = '/account/verification'
params = {}
if user_id is None:
raise AppwriteException('Missing required parameter: "user_id"')
Expand All @@ -291,26 +320,26 @@ def update_verification(self, user_id, secret):
params['userId'] = user_id
params['secret'] = secret

return self.client.call('put', path, {
return self.client.call('put', api_path, {
'content-type': 'application/json',
}, params)

def create_phone_verification(self):
"""Create Phone Verification"""


path = '/account/verification/phone'
api_path = '/account/verification/phone'
params = {}

return self.client.call('post', path, {
return self.client.call('post', api_path, {
'content-type': 'application/json',
}, params)

def update_phone_verification(self, user_id, secret):
"""Create Phone Verification (confirmation)"""


path = '/account/verification/phone'
api_path = '/account/verification/phone'
params = {}
if user_id is None:
raise AppwriteException('Missing required parameter: "user_id"')
Expand All @@ -322,6 +351,6 @@ def update_phone_verification(self, user_id, secret):
params['userId'] = user_id
params['secret'] = secret

return self.client.call('put', path, {
return self.client.call('put', api_path, {
'content-type': 'application/json',
}, params)
Loading

0 comments on commit f24f9b2

Please sign in to comment.