Skip to content

Commit e8d6be4

Browse files
Merge pull request #44 from appwrite/dev
updated to support 1.0.0-RC1
2 parents 2c561e2 + ef6bd15 commit e8d6be4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1190
-550
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ Redistribution and use in source and binary forms, with or without modification,
99

1010
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.
1111

12-
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.
12+
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.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Appwrite Python SDK
22

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

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

1111
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)
1212

appwrite/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ def __init__(self):
1111
self._endpoint = 'https://HOSTNAME/v1'
1212
self._global_headers = {
1313
'content-type': '',
14-
'x-sdk-version': 'appwrite:python:0.10.0',
15-
'X-Appwrite-Response-Format' : '0.15.0',
14+
'x-sdk-name': 'Python',
15+
'x-sdk-platform': 'server',
16+
'x-sdk-language': 'python',
17+
'x-sdk-version': '1.0.0-RC1',
18+
'X-Appwrite-Response-Format' : '1.0.0-RC1',
1619
}
1720

1821
def set_self_signed(self, status=True):

appwrite/id.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class ID:
2+
@staticmethod
3+
def custom(id):
4+
return id
5+
6+
@staticmethod
7+
def unique():
8+
return 'unique()'

appwrite/permission.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Permission:
2+
3+
@staticmethod
4+
def read(role):
5+
return f'read("{role}")'
6+
7+
@staticmethod
8+
def write(role):
9+
return f'write("{role}")'
10+
11+
@staticmethod
12+
def create(role):
13+
return f'create("{role}")'
14+
15+
@staticmethod
16+
def update(role):
17+
return f'update("{role}")'
18+
19+
@staticmethod
20+
def delete(role):
21+
return f'delete("{role}")'

appwrite/query.py

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,59 @@ def notEqual(attribute, value):
88
return Query.addQuery(attribute, "notEqual", value)
99

1010
@staticmethod
11-
def lesser(attribute, value):
12-
return Query.addQuery(attribute, "lesser", value)
11+
def lessThan(attribute, value):
12+
return Query.addQuery(attribute, "lessThan", value)
1313

1414
@staticmethod
15-
def lesserEqual(attribute, value):
16-
return Query.addQuery(attribute, "lesserEqual", value)
15+
def lessThanEqual(attribute, value):
16+
return Query.addQuery(attribute, "lessThanEqual", value)
1717

1818
@staticmethod
19-
def greater(attribute, value):
20-
return Query.addQuery(attribute, "greater", value)
19+
def greaterThan(attribute, value):
20+
return Query.addQuery(attribute, "greaterThan", value)
2121

2222
@staticmethod
23-
def greaterEqual(attribute, value):
24-
return Query.addQuery(attribute, "greaterEqual", value)
23+
def greaterThanEqual(attribute, value):
24+
return Query.addQuery(attribute, "greaterThanEqual", value)
2525

2626
@staticmethod
2727
def search(attribute, value):
2828
return Query.addQuery(attribute, "search", value)
2929

3030
@staticmethod
31-
def addQuery(attribute, oper, value):
31+
def orderAsc(attribute):
32+
return f'orderAsc("{attribute}")'
33+
34+
@staticmethod
35+
def orderDesc(attribute):
36+
return f'orderDesc("{attribute}")'
37+
38+
@staticmethod
39+
def cursorBefore(id):
40+
return f'cursorBefore("{id}")'
41+
42+
@staticmethod
43+
def cursorAfter(id):
44+
return f'cursorAfter("{id}")'
45+
46+
@staticmethod
47+
def limit(limit):
48+
return f'limit({limit})'
49+
50+
@staticmethod
51+
def offset(offset):
52+
return f'offset({offset})'
53+
54+
@staticmethod
55+
def addQuery(attribute, method, value):
3256
if type(value) == list:
33-
return '{}.{}({})'.format(attribute,oper, ','.join(map(Query.parseValues, value)))
57+
return f'{method}("{attribute}", [{",".join(map(Query.parseValues, value))}])'
3458
else:
35-
return '{}.{}({})'.format(attribute,oper, Query.parseValues(value))
59+
return f'{method}("{attribute}", [{Query.parseValues(value)}])'
3660

3761
@staticmethod
3862
def parseValues(value):
3963
if type(value) == str:
40-
return '"{}"'.format(value)
64+
return f'"{value}"'
4165
else:
42-
return value
66+
return str(value)

appwrite/role.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
class Role:
2+
@staticmethod
3+
def any():
4+
return 'any'
5+
6+
@staticmethod
7+
def user(id):
8+
return f'user:{id}'
9+
10+
@staticmethod
11+
def users():
12+
return 'users'
13+
14+
@staticmethod
15+
def guests():
16+
return 'guests'
17+
18+
@staticmethod
19+
def team(id, role = ""):
20+
if role:
21+
return f'team:{id}/{role}'
22+
return f'team:{id}'
23+
24+
@staticmethod
25+
def status(status):
26+
return f'status:{status}'

0 commit comments

Comments
 (0)