Skip to content

Commit 67e6781

Browse files
authored
Merge pull request #138 from appwrite/dev
2 parents aa01904 + d72b7aa commit 67e6781

Some content is hidden

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

47 files changed

+1110
-235
lines changed

CHANGELOG.md

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

3+
## 17.0.0
4+
5+
* [BREAKING] Changed `$sequence` type from `float` to `str` for `Row` and `Document` models
6+
* [BREAKING] Renamed `IndexType` enum: split into `DatabasesIndexType` (with new `SPATIAL` value) and `TablesDBIndexType`
7+
* [BREAKING] Replaced `specification` parameter with `build_specification` and `runtime_specification` in `functions.create()`, `functions.update()`, `sites.create()`, `sites.update()`
8+
* Added new `Project` service with full CRUD for project-level environment variables
9+
* Added new `Webhooks` service with full CRUD for project webhooks (including `update_signature`)
10+
* Added `Webhook` and `WebhookList` models
11+
* Added `users.update_impersonator()` method for enabling/disabling user impersonation
12+
* Added impersonation support: `set_impersonate_user_id()`, `set_impersonate_user_email()`, `set_impersonate_user_phone()` on `Client`
13+
* Added `impersonator` and `impersonatoruserid` optional fields to `User` model
14+
* Added `deployment_retention` parameter to Functions and Sites create/update
15+
* Added `start_command` parameter to Sites create/update
16+
* Added `Documentsdb`, `Vectorsdb` values to `BackupServices` and `DatabaseType` enums
17+
* Added `WebhooksRead`, `WebhooksWrite`, `ProjectRead`, `ProjectWrite` scopes
18+
* Removed `get_queue_billing_project_aggregation`, `get_queue_billing_team_aggregation`, `get_queue_priority_builds`, `get_queue_region_manager`, `get_queue_threats` from `Health` service
19+
* Updated `Log` model field descriptions to clarify impersonation behavior
20+
* Updated `X-Appwrite-Response-Format` header to `1.9.0`
21+
322
## 16.0.0
423

524
* Breaking change: All service methods now return typed Pydantic models instead of `Dict[str, Any]`

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-1.8.1-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.9.0-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 1.8.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.9.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: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ def __init__(self):
1515
self._endpoint = 'https://cloud.appwrite.io/v1'
1616
self._global_headers = {
1717
'content-type': '',
18-
'user-agent' : f'AppwritePythonSDK/16.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
18+
'user-agent' : f'AppwritePythonSDK/17.0.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': '16.0.0',
23-
'X-Appwrite-Response-Format' : '1.8.0',
22+
'x-sdk-version': '17.0.0',
23+
'X-Appwrite-Response-Format' : '1.9.0',
2424
}
2525

2626
def set_self_signed(self, status=True):
@@ -72,6 +72,24 @@ def set_forwarded_user_agent(self, value):
7272
self._global_headers['x-forwarded-user-agent'] = value
7373
return self
7474

75+
def set_impersonate_user_id(self, value):
76+
"""Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data."""
77+
78+
self._global_headers['x-appwrite-impersonate-user-id'] = value
79+
return self
80+
81+
def set_impersonate_user_email(self, value):
82+
"""Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data."""
83+
84+
self._global_headers['x-appwrite-impersonate-user-email'] = value
85+
return self
86+
87+
def set_impersonate_user_phone(self, value):
88+
"""Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data."""
89+
90+
self._global_headers['x-appwrite-impersonate-user-phone'] = value
91+
return self
92+
7593
def call(self, method, path='', headers=None, params=None, response_type='json'):
7694
if headers is None:
7795
headers = {}

appwrite/encoders/value_class_encoder.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ..enums.backup_services import BackupServices
1414
from ..enums.relationship_type import RelationshipType
1515
from ..enums.relation_mutate import RelationMutate
16-
from ..enums.index_type import IndexType
16+
from ..enums.databases_index_type import DatabasesIndexType
1717
from ..enums.order_by import OrderBy
1818
from ..enums.runtime import Runtime
1919
from ..enums.scopes import Scopes
@@ -29,6 +29,7 @@
2929
from ..enums.adapter import Adapter
3030
from ..enums.compression import Compression
3131
from ..enums.image_gravity import ImageGravity
32+
from ..enums.tables_db_index_type import TablesDBIndexType
3233
from ..enums.password_hash import PasswordHash
3334
from ..enums.messaging_provider_type import MessagingProviderType
3435
from ..enums.database_type import DatabaseType
@@ -86,7 +87,7 @@ def default(self, o):
8687
if isinstance(o, RelationMutate):
8788
return o.value
8889

89-
if isinstance(o, IndexType):
90+
if isinstance(o, DatabasesIndexType):
9091
return o.value
9192

9293
if isinstance(o, OrderBy):
@@ -134,6 +135,9 @@ def default(self, o):
134135
if isinstance(o, ImageGravity):
135136
return o.value
136137

138+
if isinstance(o, TablesDBIndexType):
139+
return o.value
140+
137141
if isinstance(o, PasswordHash):
138142
return o.value
139143

appwrite/enums/backup_services.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22

33
class BackupServices(Enum):
44
DATABASES = "databases"
5+
TABLESDB = "tablesdb"
6+
DOCUMENTSDB = "documentsdb"
7+
VECTORSDB = "vectorsdb"
58
FUNCTIONS = "functions"
69
STORAGE = "storage"

appwrite/enums/database_type.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
class DatabaseType(Enum):
44
LEGACY = "legacy"
55
TABLESDB = "tablesdb"
6+
DOCUMENTSDB = "documentsdb"
7+
VECTORSDB = "vectorsdb"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from enum import Enum
2+
3+
class DatabasesIndexType(Enum):
4+
KEY = "key"
5+
FULLTEXT = "fulltext"
6+
UNIQUE = "unique"
7+
SPATIAL = "spatial"

appwrite/enums/scopes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ class Scopes(Enum):
5858
ASSISTANT_READ = "assistant.read"
5959
TOKENS_READ = "tokens.read"
6060
TOKENS_WRITE = "tokens.write"
61+
WEBHOOKS_READ = "webhooks.read"
62+
WEBHOOKS_WRITE = "webhooks.write"
63+
PROJECT_READ = "project.read"
64+
PROJECT_WRITE = "project.write"
6165
POLICIES_WRITE = "policies.write"
6266
POLICIES_READ = "policies.read"
6367
ARCHIVES_READ = "archives.read"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from enum import Enum
22

3-
class IndexType(Enum):
3+
class TablesDBIndexType(Enum):
44
KEY = "key"
55
FULLTEXT = "fulltext"
66
UNIQUE = "unique"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from enum import Enum
22

33
class TemplateReferenceType(Enum):
4-
BRANCH = "branch"
54
COMMIT = "commit"
5+
BRANCH = "branch"
66
TAG = "tag"

0 commit comments

Comments
 (0)