Skip to content

Commit 61ca333

Browse files
authored
Merge pull request #133 from appwrite/dev
feat: Python SDK update for version 15.2.0
2 parents 679e812 + bb2d41b commit 61ca333

24 files changed

+215
-74
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change Log
22

3+
## 15.2.0
4+
5+
* Extended BuildRuntime and Runtime enums with new runtime versions (e.g., node-23/24/25, php-8.4, ruby-3.4/4.0, python-3.13/3.14, python-ml-3.13, deno-2.5/2.6, dotnet-10, java-25, swift-6.2, kotlin-2.3, bun-1.2/1.3, go-1.24/1.25/1.26).
6+
* Added new permission scopes: schedules.read, schedules.write, and events.read.
7+
* Added contains_any and contains_all filter helpers to the Query API (plus enhanced contains with docstrings).
8+
* Added optional encrypt parameter to all string attribute creation methods (e.g., longtext, mediumtext, text, varchar) in Databases to support encryption at rest.
9+
* Updated README to reflect Appwrite server compatibility version 1.8.x.
10+
* Backward-compatible enhancements: no breaking changes.
11+
312
## 15.1.0
413

514
* Add `dart-3.10` and `flutter-3.38` to `BuildRuntime` and `Runtime` enums

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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 latest. 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.8.x. 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 abstracts and simplifies 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def __init__(self):
1515
self._endpoint = 'https://cloud.appwrite.io/v1'
1616
self._global_headers = {
1717
'content-type': '',
18-
'user-agent' : f'AppwritePythonSDK/15.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
18+
'user-agent' : f'AppwritePythonSDK/15.2.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
1919
'x-sdk-name': 'Python',
2020
'x-sdk-platform': 'server',
2121
'x-sdk-language': 'python',
22-
'x-sdk-version': '15.1.0',
22+
'x-sdk-version': '15.2.0',
2323
'X-Appwrite-Response-Format' : '1.8.0',
2424
}
2525

appwrite/enums/build_runtime.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,35 @@ class BuildRuntime(Enum):
88
NODE_20_0 = "node-20.0"
99
NODE_21_0 = "node-21.0"
1010
NODE_22 = "node-22"
11+
NODE_23 = "node-23"
12+
NODE_24 = "node-24"
13+
NODE_25 = "node-25"
1114
PHP_8_0 = "php-8.0"
1215
PHP_8_1 = "php-8.1"
1316
PHP_8_2 = "php-8.2"
1417
PHP_8_3 = "php-8.3"
18+
PHP_8_4 = "php-8.4"
1519
RUBY_3_0 = "ruby-3.0"
1620
RUBY_3_1 = "ruby-3.1"
1721
RUBY_3_2 = "ruby-3.2"
1822
RUBY_3_3 = "ruby-3.3"
23+
RUBY_3_4 = "ruby-3.4"
24+
RUBY_4_0 = "ruby-4.0"
1925
PYTHON_3_8 = "python-3.8"
2026
PYTHON_3_9 = "python-3.9"
2127
PYTHON_3_10 = "python-3.10"
2228
PYTHON_3_11 = "python-3.11"
2329
PYTHON_3_12 = "python-3.12"
30+
PYTHON_3_13 = "python-3.13"
31+
PYTHON_3_14 = "python-3.14"
2432
PYTHON_ML_3_11 = "python-ml-3.11"
2533
PYTHON_ML_3_12 = "python-ml-3.12"
34+
PYTHON_ML_3_13 = "python-ml-3.13"
2635
DENO_1_40 = "deno-1.40"
2736
DENO_1_46 = "deno-1.46"
2837
DENO_2_0 = "deno-2.0"
38+
DENO_2_5 = "deno-2.5"
39+
DENO_2_6 = "deno-2.6"
2940
DART_2_15 = "dart-2.15"
3041
DART_2_16 = "dart-2.16"
3142
DART_2_17 = "dart-2.17"
@@ -41,25 +52,34 @@ class BuildRuntime(Enum):
4152
DOTNET_6_0 = "dotnet-6.0"
4253
DOTNET_7_0 = "dotnet-7.0"
4354
DOTNET_8_0 = "dotnet-8.0"
55+
DOTNET_10 = "dotnet-10"
4456
JAVA_8_0 = "java-8.0"
4557
JAVA_11_0 = "java-11.0"
4658
JAVA_17_0 = "java-17.0"
4759
JAVA_18_0 = "java-18.0"
4860
JAVA_21_0 = "java-21.0"
4961
JAVA_22 = "java-22"
62+
JAVA_25 = "java-25"
5063
SWIFT_5_5 = "swift-5.5"
5164
SWIFT_5_8 = "swift-5.8"
5265
SWIFT_5_9 = "swift-5.9"
5366
SWIFT_5_10 = "swift-5.10"
67+
SWIFT_6_2 = "swift-6.2"
5468
KOTLIN_1_6 = "kotlin-1.6"
5569
KOTLIN_1_8 = "kotlin-1.8"
5670
KOTLIN_1_9 = "kotlin-1.9"
5771
KOTLIN_2_0 = "kotlin-2.0"
72+
KOTLIN_2_3 = "kotlin-2.3"
5873
CPP_17 = "cpp-17"
5974
CPP_20 = "cpp-20"
6075
BUN_1_0 = "bun-1.0"
6176
BUN_1_1 = "bun-1.1"
77+
BUN_1_2 = "bun-1.2"
78+
BUN_1_3 = "bun-1.3"
6279
GO_1_23 = "go-1.23"
80+
GO_1_24 = "go-1.24"
81+
GO_1_25 = "go-1.25"
82+
GO_1_26 = "go-1.26"
6383
STATIC_1 = "static-1"
6484
FLUTTER_3_24 = "flutter-3.24"
6585
FLUTTER_3_27 = "flutter-3.27"

appwrite/enums/runtime.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,35 @@ class Runtime(Enum):
88
NODE_20_0 = "node-20.0"
99
NODE_21_0 = "node-21.0"
1010
NODE_22 = "node-22"
11+
NODE_23 = "node-23"
12+
NODE_24 = "node-24"
13+
NODE_25 = "node-25"
1114
PHP_8_0 = "php-8.0"
1215
PHP_8_1 = "php-8.1"
1316
PHP_8_2 = "php-8.2"
1417
PHP_8_3 = "php-8.3"
18+
PHP_8_4 = "php-8.4"
1519
RUBY_3_0 = "ruby-3.0"
1620
RUBY_3_1 = "ruby-3.1"
1721
RUBY_3_2 = "ruby-3.2"
1822
RUBY_3_3 = "ruby-3.3"
23+
RUBY_3_4 = "ruby-3.4"
24+
RUBY_4_0 = "ruby-4.0"
1925
PYTHON_3_8 = "python-3.8"
2026
PYTHON_3_9 = "python-3.9"
2127
PYTHON_3_10 = "python-3.10"
2228
PYTHON_3_11 = "python-3.11"
2329
PYTHON_3_12 = "python-3.12"
30+
PYTHON_3_13 = "python-3.13"
31+
PYTHON_3_14 = "python-3.14"
2432
PYTHON_ML_3_11 = "python-ml-3.11"
2533
PYTHON_ML_3_12 = "python-ml-3.12"
34+
PYTHON_ML_3_13 = "python-ml-3.13"
2635
DENO_1_40 = "deno-1.40"
2736
DENO_1_46 = "deno-1.46"
2837
DENO_2_0 = "deno-2.0"
38+
DENO_2_5 = "deno-2.5"
39+
DENO_2_6 = "deno-2.6"
2940
DART_2_15 = "dart-2.15"
3041
DART_2_16 = "dart-2.16"
3142
DART_2_17 = "dart-2.17"
@@ -41,25 +52,34 @@ class Runtime(Enum):
4152
DOTNET_6_0 = "dotnet-6.0"
4253
DOTNET_7_0 = "dotnet-7.0"
4354
DOTNET_8_0 = "dotnet-8.0"
55+
DOTNET_10 = "dotnet-10"
4456
JAVA_8_0 = "java-8.0"
4557
JAVA_11_0 = "java-11.0"
4658
JAVA_17_0 = "java-17.0"
4759
JAVA_18_0 = "java-18.0"
4860
JAVA_21_0 = "java-21.0"
4961
JAVA_22 = "java-22"
62+
JAVA_25 = "java-25"
5063
SWIFT_5_5 = "swift-5.5"
5164
SWIFT_5_8 = "swift-5.8"
5265
SWIFT_5_9 = "swift-5.9"
5366
SWIFT_5_10 = "swift-5.10"
67+
SWIFT_6_2 = "swift-6.2"
5468
KOTLIN_1_6 = "kotlin-1.6"
5569
KOTLIN_1_8 = "kotlin-1.8"
5670
KOTLIN_1_9 = "kotlin-1.9"
5771
KOTLIN_2_0 = "kotlin-2.0"
72+
KOTLIN_2_3 = "kotlin-2.3"
5873
CPP_17 = "cpp-17"
5974
CPP_20 = "cpp-20"
6075
BUN_1_0 = "bun-1.0"
6176
BUN_1_1 = "bun-1.1"
77+
BUN_1_2 = "bun-1.2"
78+
BUN_1_3 = "bun-1.3"
6279
GO_1_23 = "go-1.23"
80+
GO_1_24 = "go-1.24"
81+
GO_1_25 = "go-1.25"
82+
GO_1_26 = "go-1.26"
6383
STATIC_1 = "static-1"
6484
FLUTTER_3_24 = "flutter-3.24"
6585
FLUTTER_3_27 = "flutter-3.27"

appwrite/enums/scopes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class Scopes(Enum):
4949
TARGETS_WRITE = "targets.write"
5050
RULES_READ = "rules.read"
5151
RULES_WRITE = "rules.write"
52+
SCHEDULES_READ = "schedules.read"
53+
SCHEDULES_WRITE = "schedules.write"
5254
MIGRATIONS_READ = "migrations.read"
5355
MIGRATIONS_WRITE = "migrations.write"
5456
VCS_READ = "vcs.read"
@@ -64,3 +66,4 @@ class Scopes(Enum):
6466
RESTORATIONS_WRITE = "restorations.write"
6567
DOMAINS_READ = "domains.read"
6668
DOMAINS_WRITE = "domains.write"
69+
EVENTS_READ = "events.read"

appwrite/query.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,32 @@ def offset(offset):
140140

141141
@staticmethod
142142
def contains(attribute, value):
143+
"""
144+
Filter resources where attribute contains the specified value.
145+
For string attributes, checks if the string contains the substring.
146+
147+
Note: For array attributes, use contains_any() or contains_all() instead.
148+
"""
143149
return str(Query("contains", attribute, value))
144150

151+
@staticmethod
152+
def contains_any(attribute, value):
153+
"""
154+
Filter resources where attribute contains ANY of the specified values.
155+
For array and relationship attributes, matches documents where the attribute
156+
contains at least one of the given values.
157+
"""
158+
return str(Query("containsAny", attribute, value))
159+
160+
@staticmethod
161+
def contains_all(attribute, value):
162+
"""
163+
Filter resources where attribute contains ALL of the specified values.
164+
For array and relationship attributes, matches documents where the attribute
165+
contains every one of the given values.
166+
"""
167+
return str(Query("containsAll", attribute, value))
168+
145169
@staticmethod
146170
def not_contains(attribute, value):
147171
return str(Query("notContains", attribute, value))

appwrite/services/activities.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
from ..service import Service
2+
from typing import List, Dict, Any, Optional
3+
from ..exception import AppwriteException
4+
from appwrite.utils.deprecated import deprecated
5+
6+
class Activities(Service):
7+
8+
def __init__(self, client) -> None:
9+
super(Activities, self).__init__(client)
10+
11+
def list_events(self, queries: Optional[str] = None) -> Dict[str, Any]:
12+
"""
13+
List all events for selected filters.
14+
15+
Parameters
16+
----------
17+
queries : Optional[str]
18+
Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc.
19+
20+
Returns
21+
-------
22+
Dict[str, Any]
23+
API response as a dictionary
24+
25+
Raises
26+
------
27+
AppwriteException
28+
If API request fails
29+
"""
30+
31+
api_path = '/activities/events'
32+
api_params = {}
33+
34+
if queries is not None:
35+
api_params['queries'] = queries
36+
37+
return self.client.call('get', api_path, {
38+
}, api_params)
39+
40+
def get_event(self, event_id: str) -> Dict[str, Any]:
41+
"""
42+
Get event by ID.
43+
44+
45+
Parameters
46+
----------
47+
event_id : str
48+
Event ID.
49+
50+
Returns
51+
-------
52+
Dict[str, Any]
53+
API response as a dictionary
54+
55+
Raises
56+
------
57+
AppwriteException
58+
If API request fails
59+
"""
60+
61+
api_path = '/activities/events/{eventId}'
62+
api_params = {}
63+
if event_id is None:
64+
raise AppwriteException('Missing required parameter: "event_id"')
65+
66+
api_path = api_path.replace('{eventId}', event_id)
67+
68+
69+
return self.client.call('get', api_path, {
70+
}, api_params)

0 commit comments

Comments
 (0)