Skip to content

Commit

Permalink
Merge pull request #51 from appwrite/dev
Browse files Browse the repository at this point in the history
Appwrite 1.2.0 support
  • Loading branch information
eldadfux authored Dec 27, 2022
2 parents e8d321b + 37eba10 commit 7ded6e2
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 169 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Redistribution and use in source and binary forms, with or without modification,

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.0.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.2.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.0.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.2.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
2 changes: 1 addition & 1 deletion appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self):
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '1.1.0',
'x-sdk-version': '1.2.0',
'X-Appwrite-Response-Format' : '1.0.0',
}

Expand Down
24 changes: 12 additions & 12 deletions appwrite/services/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get(self):
}, params)

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


path = '/account/email'
Expand All @@ -38,7 +38,7 @@ def update_email(self, email, password):
}, params)

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


path = '/account/logs'
Expand All @@ -51,7 +51,7 @@ def list_logs(self, queries = None):
}, params)

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


path = '/account/name'
Expand All @@ -67,7 +67,7 @@ def update_name(self, name):
}, params)

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


path = '/account/password'
Expand All @@ -84,7 +84,7 @@ def update_password(self, password, old_password = None):
}, params)

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


path = '/account/phone'
Expand Down Expand Up @@ -115,7 +115,7 @@ def get_prefs(self):
}, params)

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


path = '/account/prefs'
Expand Down Expand Up @@ -179,7 +179,7 @@ def update_recovery(self, user_id, secret, password, password_again):
}, params)

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


path = '/account/sessions'
Expand All @@ -190,7 +190,7 @@ def list_sessions(self):
}, params)

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


path = '/account/sessions'
Expand All @@ -201,7 +201,7 @@ def delete_sessions(self):
}, params)

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


path = '/account/sessions/{sessionId}'
Expand All @@ -217,7 +217,7 @@ def get_session(self, session_id):
}, params)

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


path = '/account/sessions/{sessionId}'
Expand All @@ -233,7 +233,7 @@ def update_session(self, session_id):
}, params)

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


path = '/account/sessions/{sessionId}'
Expand All @@ -249,7 +249,7 @@ def delete_session(self, session_id):
}, params)

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


path = '/account/status'
Expand Down
4 changes: 2 additions & 2 deletions appwrite/services/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ def delete_deployment(self, function_id, deployment_id):
'content-type': 'application/json',
}, params)

def retry_build(self, function_id, deployment_id, build_id):
"""Retry Build"""
def create_build(self, function_id, deployment_id, build_id):
"""Create Build"""


path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'
Expand Down
41 changes: 41 additions & 0 deletions appwrite/services/graphql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from ..service import Service
from ..exception import AppwriteException

class Graphql(Service):

def __init__(self, client):
super(Graphql, self).__init__(client)

def query(self, query):
"""GraphQL Endpoint"""


path = '/graphql'
params = {}
if query is None:
raise AppwriteException('Missing required parameter: "query"')


params['query'] = query

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

def mutation(self, query):
"""GraphQL Endpoint"""


path = '/graphql/mutation'
params = {}
if query is None:
raise AppwriteException('Missing required parameter: "query"')


params['query'] = query

return self.client.call('post', path, {
'x-sdk-graphql': 'true',
'content-type': 'application/json',
}, params)
14 changes: 0 additions & 14 deletions docs/examples/account/get-logs.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/account/get-sessions.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/examples/account/update-phone.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ client = Client()

account = Account(client)

result = account.update_phone('', 'password')
result = account.update_phone('+12065550100', 'password')
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ client = Client()

functions = Functions(client)

result = functions.retry_build('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]')
result = functions.create_build('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]')
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from appwrite.client import Client
from appwrite.services.locale import Locale
from appwrite.services.graphql import Graphql

client = Client()

Expand All @@ -9,6 +9,6 @@ client = Client()
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)

locale = Locale(client)
graphql = Graphql(client)

result = locale.get_currencies()
result = graphql.mutation({})
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from appwrite.client import Client
from appwrite.services.locale import Locale
from appwrite.services.graphql import Graphql

client = Client()

Expand All @@ -9,6 +9,6 @@ client = Client()
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)

locale = Locale(client)
graphql = Graphql(client)

result = locale.get_languages()
result = graphql.query({})
14 changes: 0 additions & 14 deletions docs/examples/locale/get-continents.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/locale/get-countries-e-u.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/locale/get-countries-phones.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/locale/get-countries.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/teams/get-memberships.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/users/get-logs.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/users/get-memberships.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/users/get-sessions.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/examples/users/update-phone.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ client = Client()

users = Users(client)

result = users.update_phone('[USER_ID]', '')
result = users.update_phone('[USER_ID]', '+12065550100')
Loading

0 comments on commit 7ded6e2

Please sign in to comment.