Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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.8.1-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.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)
Expand Down
20 changes: 19 additions & 1 deletion appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self):
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '16.0.0',
'X-Appwrite-Response-Format' : '1.8.0',
'X-Appwrite-Response-Format' : '1.9.0',
}

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

def set_impersonate_user_id(self, value):
"""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."""

self._global_headers['x-appwrite-impersonate-user-id'] = value
return self

def set_impersonate_user_email(self, value):
"""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."""

self._global_headers['x-appwrite-impersonate-user-email'] = value
return self

def set_impersonate_user_phone(self, value):
"""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."""

self._global_headers['x-appwrite-impersonate-user-phone'] = value
return self

def call(self, method, path='', headers=None, params=None, response_type='json'):
if headers is None:
headers = {}
Expand Down
20 changes: 18 additions & 2 deletions appwrite/encoders/value_class_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
from ..enums.backup_services import BackupServices
from ..enums.relationship_type import RelationshipType
from ..enums.relation_mutate import RelationMutate
from ..enums.index_type import IndexType
from ..enums.databases_index_type import DatabasesIndexType
from ..enums.order_by import OrderBy
from ..enums.documents_db_index_type import DocumentsDBIndexType
from ..enums.runtime import Runtime
from ..enums.scopes import Scopes
from ..enums.template_reference_type import TemplateReferenceType
Expand All @@ -29,8 +30,11 @@
from ..enums.adapter import Adapter
from ..enums.compression import Compression
from ..enums.image_gravity import ImageGravity
from ..enums.tables_db_index_type import TablesDBIndexType
from ..enums.password_hash import PasswordHash
from ..enums.messaging_provider_type import MessagingProviderType
from ..enums.model import Model
from ..enums.vectors_db_index_type import VectorsDBIndexType
from ..enums.database_type import DatabaseType
from ..enums.attribute_status import AttributeStatus
from ..enums.column_status import ColumnStatus
Expand Down Expand Up @@ -86,12 +90,15 @@ def default(self, o):
if isinstance(o, RelationMutate):
return o.value

if isinstance(o, IndexType):
if isinstance(o, DatabasesIndexType):
return o.value

if isinstance(o, OrderBy):
return o.value

if isinstance(o, DocumentsDBIndexType):
return o.value

if isinstance(o, Runtime):
return o.value

Expand Down Expand Up @@ -134,12 +141,21 @@ def default(self, o):
if isinstance(o, ImageGravity):
return o.value

if isinstance(o, TablesDBIndexType):
return o.value

if isinstance(o, PasswordHash):
return o.value

if isinstance(o, MessagingProviderType):
return o.value

if isinstance(o, Model):
return o.value

if isinstance(o, VectorsDBIndexType):
return o.value

if isinstance(o, DatabaseType):
return o.value

Expand Down
3 changes: 3 additions & 0 deletions appwrite/enums/backup_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@

class BackupServices(Enum):
DATABASES = "databases"
TABLESDB = "tablesdb"
DOCUMENTSDB = "documentsdb"
VECTORSDB = "vectorsdb"
FUNCTIONS = "functions"
STORAGE = "storage"
86 changes: 86 additions & 0 deletions appwrite/enums/build_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,89 @@ class BuildRuntime(Enum):
FLUTTER_3_32 = "flutter-3.32"
FLUTTER_3_35 = "flutter-3.35"
FLUTTER_3_38 = "flutter-3.38"
NODE_14_5_RC = "node-14.5-rc"
NODE_16_0_RC = "node-16.0-rc"
NODE_18_0_RC = "node-18.0-rc"
NODE_19_0_RC = "node-19.0-rc"
NODE_20_0_RC = "node-20.0-rc"
NODE_21_0_RC = "node-21.0-rc"
NODE_22_RC = "node-22-rc"
NODE_23_RC = "node-23-rc"
NODE_24_RC = "node-24-rc"
NODE_25_RC = "node-25-rc"
PHP_8_0_RC = "php-8.0-rc"
PHP_8_1_RC = "php-8.1-rc"
PHP_8_2_RC = "php-8.2-rc"
PHP_8_3_RC = "php-8.3-rc"
PHP_8_4_RC = "php-8.4-rc"
RUBY_3_0_RC = "ruby-3.0-rc"
RUBY_3_1_RC = "ruby-3.1-rc"
RUBY_3_2_RC = "ruby-3.2-rc"
RUBY_3_3_RC = "ruby-3.3-rc"
RUBY_3_4_RC = "ruby-3.4-rc"
RUBY_4_0_RC = "ruby-4.0-rc"
PYTHON_3_8_RC = "python-3.8-rc"
PYTHON_3_9_RC = "python-3.9-rc"
PYTHON_3_10_RC = "python-3.10-rc"
PYTHON_3_11_RC = "python-3.11-rc"
PYTHON_3_12_RC = "python-3.12-rc"
PYTHON_3_13_RC = "python-3.13-rc"
PYTHON_3_14_RC = "python-3.14-rc"
PYTHON_ML_3_11_RC = "python-ml-3.11-rc"
PYTHON_ML_3_12_RC = "python-ml-3.12-rc"
PYTHON_ML_3_13_RC = "python-ml-3.13-rc"
DENO_1_40_RC = "deno-1.40-rc"
DENO_1_46_RC = "deno-1.46-rc"
DENO_2_0_RC = "deno-2.0-rc"
DENO_2_5_RC = "deno-2.5-rc"
DENO_2_6_RC = "deno-2.6-rc"
DART_2_15_RC = "dart-2.15-rc"
DART_2_16_RC = "dart-2.16-rc"
DART_2_17_RC = "dart-2.17-rc"
DART_2_18_RC = "dart-2.18-rc"
DART_2_19_RC = "dart-2.19-rc"
DART_3_0_RC = "dart-3.0-rc"
DART_3_1_RC = "dart-3.1-rc"
DART_3_3_RC = "dart-3.3-rc"
DART_3_5_RC = "dart-3.5-rc"
DART_3_8_RC = "dart-3.8-rc"
DART_3_9_RC = "dart-3.9-rc"
DART_3_10_RC = "dart-3.10-rc"
DOTNET_6_0_RC = "dotnet-6.0-rc"
DOTNET_7_0_RC = "dotnet-7.0-rc"
DOTNET_8_0_RC = "dotnet-8.0-rc"
DOTNET_10_RC = "dotnet-10-rc"
JAVA_8_0_RC = "java-8.0-rc"
JAVA_11_0_RC = "java-11.0-rc"
JAVA_17_0_RC = "java-17.0-rc"
JAVA_18_0_RC = "java-18.0-rc"
JAVA_21_0_RC = "java-21.0-rc"
JAVA_22_RC = "java-22-rc"
JAVA_25_RC = "java-25-rc"
SWIFT_5_5_RC = "swift-5.5-rc"
SWIFT_5_8_RC = "swift-5.8-rc"
SWIFT_5_9_RC = "swift-5.9-rc"
SWIFT_5_10_RC = "swift-5.10-rc"
SWIFT_6_2_RC = "swift-6.2-rc"
KOTLIN_1_6_RC = "kotlin-1.6-rc"
KOTLIN_1_8_RC = "kotlin-1.8-rc"
KOTLIN_1_9_RC = "kotlin-1.9-rc"
KOTLIN_2_0_RC = "kotlin-2.0-rc"
KOTLIN_2_3_RC = "kotlin-2.3-rc"
CPP_17_RC = "cpp-17-rc"
CPP_20_RC = "cpp-20-rc"
BUN_1_0_RC = "bun-1.0-rc"
BUN_1_1_RC = "bun-1.1-rc"
BUN_1_2_RC = "bun-1.2-rc"
BUN_1_3_RC = "bun-1.3-rc"
GO_1_23_RC = "go-1.23-rc"
GO_1_24_RC = "go-1.24-rc"
GO_1_25_RC = "go-1.25-rc"
GO_1_26_RC = "go-1.26-rc"
STATIC_1_RC = "static-1-rc"
FLUTTER_3_24_RC = "flutter-3.24-rc"
FLUTTER_3_27_RC = "flutter-3.27-rc"
FLUTTER_3_29_RC = "flutter-3.29-rc"
FLUTTER_3_32_RC = "flutter-3.32-rc"
FLUTTER_3_35_RC = "flutter-3.35-rc"
FLUTTER_3_38_RC = "flutter-3.38-rc"
2 changes: 2 additions & 0 deletions appwrite/enums/database_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
class DatabaseType(Enum):
LEGACY = "legacy"
TABLESDB = "tablesdb"
DOCUMENTSDB = "documentsdb"
VECTORSDB = "vectorsdb"
7 changes: 7 additions & 0 deletions appwrite/enums/databases_index_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from enum import Enum

class DatabasesIndexType(Enum):
KEY = "key"
FULLTEXT = "fulltext"
UNIQUE = "unique"
SPATIAL = "spatial"
7 changes: 7 additions & 0 deletions appwrite/enums/documents_db_index_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from enum import Enum

class DocumentsDBIndexType(Enum):
KEY = "key"
FULLTEXT = "fulltext"
UNIQUE = "unique"
SPATIAL = "spatial"
4 changes: 4 additions & 0 deletions appwrite/enums/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from enum import Enum

class Model(Enum):
EMBEDDINGGEMMA = "embeddinggemma"
86 changes: 86 additions & 0 deletions appwrite/enums/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,89 @@ class Runtime(Enum):
FLUTTER_3_32 = "flutter-3.32"
FLUTTER_3_35 = "flutter-3.35"
FLUTTER_3_38 = "flutter-3.38"
NODE_14_5_RC = "node-14.5-rc"
NODE_16_0_RC = "node-16.0-rc"
NODE_18_0_RC = "node-18.0-rc"
NODE_19_0_RC = "node-19.0-rc"
NODE_20_0_RC = "node-20.0-rc"
NODE_21_0_RC = "node-21.0-rc"
NODE_22_RC = "node-22-rc"
NODE_23_RC = "node-23-rc"
NODE_24_RC = "node-24-rc"
NODE_25_RC = "node-25-rc"
PHP_8_0_RC = "php-8.0-rc"
PHP_8_1_RC = "php-8.1-rc"
PHP_8_2_RC = "php-8.2-rc"
PHP_8_3_RC = "php-8.3-rc"
PHP_8_4_RC = "php-8.4-rc"
RUBY_3_0_RC = "ruby-3.0-rc"
RUBY_3_1_RC = "ruby-3.1-rc"
RUBY_3_2_RC = "ruby-3.2-rc"
RUBY_3_3_RC = "ruby-3.3-rc"
RUBY_3_4_RC = "ruby-3.4-rc"
RUBY_4_0_RC = "ruby-4.0-rc"
PYTHON_3_8_RC = "python-3.8-rc"
PYTHON_3_9_RC = "python-3.9-rc"
PYTHON_3_10_RC = "python-3.10-rc"
PYTHON_3_11_RC = "python-3.11-rc"
PYTHON_3_12_RC = "python-3.12-rc"
PYTHON_3_13_RC = "python-3.13-rc"
PYTHON_3_14_RC = "python-3.14-rc"
PYTHON_ML_3_11_RC = "python-ml-3.11-rc"
PYTHON_ML_3_12_RC = "python-ml-3.12-rc"
PYTHON_ML_3_13_RC = "python-ml-3.13-rc"
DENO_1_40_RC = "deno-1.40-rc"
DENO_1_46_RC = "deno-1.46-rc"
DENO_2_0_RC = "deno-2.0-rc"
DENO_2_5_RC = "deno-2.5-rc"
DENO_2_6_RC = "deno-2.6-rc"
DART_2_15_RC = "dart-2.15-rc"
DART_2_16_RC = "dart-2.16-rc"
DART_2_17_RC = "dart-2.17-rc"
DART_2_18_RC = "dart-2.18-rc"
DART_2_19_RC = "dart-2.19-rc"
DART_3_0_RC = "dart-3.0-rc"
DART_3_1_RC = "dart-3.1-rc"
DART_3_3_RC = "dart-3.3-rc"
DART_3_5_RC = "dart-3.5-rc"
DART_3_8_RC = "dart-3.8-rc"
DART_3_9_RC = "dart-3.9-rc"
DART_3_10_RC = "dart-3.10-rc"
DOTNET_6_0_RC = "dotnet-6.0-rc"
DOTNET_7_0_RC = "dotnet-7.0-rc"
DOTNET_8_0_RC = "dotnet-8.0-rc"
DOTNET_10_RC = "dotnet-10-rc"
JAVA_8_0_RC = "java-8.0-rc"
JAVA_11_0_RC = "java-11.0-rc"
JAVA_17_0_RC = "java-17.0-rc"
JAVA_18_0_RC = "java-18.0-rc"
JAVA_21_0_RC = "java-21.0-rc"
JAVA_22_RC = "java-22-rc"
JAVA_25_RC = "java-25-rc"
SWIFT_5_5_RC = "swift-5.5-rc"
SWIFT_5_8_RC = "swift-5.8-rc"
SWIFT_5_9_RC = "swift-5.9-rc"
SWIFT_5_10_RC = "swift-5.10-rc"
SWIFT_6_2_RC = "swift-6.2-rc"
KOTLIN_1_6_RC = "kotlin-1.6-rc"
KOTLIN_1_8_RC = "kotlin-1.8-rc"
KOTLIN_1_9_RC = "kotlin-1.9-rc"
KOTLIN_2_0_RC = "kotlin-2.0-rc"
KOTLIN_2_3_RC = "kotlin-2.3-rc"
CPP_17_RC = "cpp-17-rc"
CPP_20_RC = "cpp-20-rc"
BUN_1_0_RC = "bun-1.0-rc"
BUN_1_1_RC = "bun-1.1-rc"
BUN_1_2_RC = "bun-1.2-rc"
BUN_1_3_RC = "bun-1.3-rc"
GO_1_23_RC = "go-1.23-rc"
GO_1_24_RC = "go-1.24-rc"
GO_1_25_RC = "go-1.25-rc"
GO_1_26_RC = "go-1.26-rc"
STATIC_1_RC = "static-1-rc"
FLUTTER_3_24_RC = "flutter-3.24-rc"
FLUTTER_3_27_RC = "flutter-3.27-rc"
FLUTTER_3_29_RC = "flutter-3.29-rc"
FLUTTER_3_32_RC = "flutter-3.32-rc"
FLUTTER_3_35_RC = "flutter-3.35-rc"
FLUTTER_3_38_RC = "flutter-3.38-rc"
4 changes: 4 additions & 0 deletions appwrite/enums/scopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class Scopes(Enum):
ASSISTANT_READ = "assistant.read"
TOKENS_READ = "tokens.read"
TOKENS_WRITE = "tokens.write"
WEBHOOKS_READ = "webhooks.read"
WEBHOOKS_WRITE = "webhooks.write"
PROJECT_READ = "project.read"
PROJECT_WRITE = "project.write"
POLICIES_WRITE = "policies.write"
POLICIES_READ = "policies.read"
ARCHIVES_READ = "archives.read"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

class IndexType(Enum):
class TablesDBIndexType(Enum):
KEY = "key"
FULLTEXT = "fulltext"
UNIQUE = "unique"
Expand Down
9 changes: 9 additions & 0 deletions appwrite/enums/vectors_db_index_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from enum import Enum

class VectorsDBIndexType(Enum):
HNSW_EUCLIDEAN = "hnsw_euclidean"
HNSW_DOT = "hnsw_dot"
HNSW_COSINE = "hnsw_cosine"
OBJECT = "object"
KEY = "key"
UNIQUE = "unique"
Loading
Loading