fix(ci): fix black/ruff failures, add CoC and PR template

- Fix Python formatting (sync no longer strips blank lines from .py files)
- Remove test_community_build.py (tests private sync module)
- Fix ruff warnings in test files
- Add CODE_OF_CONDUCT.md
- Add .github/PULL_REQUEST_TEMPLATE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
airano
2026-02-17 18:19:39 +03:30
parent c9083d86b1
commit c73e39f6e4
135 changed files with 1185 additions and 317 deletions

View File

@@ -21,6 +21,7 @@ from typing import Any
import aiohttp
class AppwriteClient:
"""
Appwrite Self-Hosted API client.

View File

@@ -13,6 +13,7 @@ from typing import Any
from plugins.appwrite.client import AppwriteClient
def get_tool_specifications() -> list[dict[str, Any]]:
"""Return tool specifications for ToolGenerator (18 tools)"""
return [
@@ -425,10 +426,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
]
# =====================
# HANDLER FUNCTIONS
# =====================
async def list_databases(
client: AppwriteClient, queries: list[str] | None = None, search: str | None = None
) -> str:
@@ -447,6 +450,7 @@ async def list_databases(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_database(client: AppwriteClient, database_id: str) -> str:
"""Get database by ID."""
try:
@@ -456,6 +460,7 @@ async def get_database(client: AppwriteClient, database_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_database(
client: AppwriteClient, database_id: str, name: str, enabled: bool = True
) -> str:
@@ -475,6 +480,7 @@ async def create_database(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_database(
client: AppwriteClient, database_id: str, name: str, enabled: bool | None = None
) -> str:
@@ -490,6 +496,7 @@ async def update_database(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_database(client: AppwriteClient, database_id: str) -> str:
"""Delete database."""
try:
@@ -501,6 +508,7 @@ async def delete_database(client: AppwriteClient, database_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_collections(
client: AppwriteClient,
database_id: str,
@@ -525,6 +533,7 @@ async def list_collections(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_collection(client: AppwriteClient, database_id: str, collection_id: str) -> str:
"""Get collection details."""
try:
@@ -534,6 +543,7 @@ async def get_collection(client: AppwriteClient, database_id: str, collection_id
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_collection(
client: AppwriteClient,
database_id: str,
@@ -566,6 +576,7 @@ async def create_collection(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_collection(
client: AppwriteClient,
database_id: str,
@@ -594,6 +605,7 @@ async def update_collection(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_collection(client: AppwriteClient, database_id: str, collection_id: str) -> str:
"""Delete collection."""
try:
@@ -606,6 +618,7 @@ async def delete_collection(client: AppwriteClient, database_id: str, collection
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_attributes(
client: AppwriteClient, database_id: str, collection_id: str, queries: list[str] | None = None
) -> str:
@@ -628,6 +641,7 @@ async def list_attributes(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_string_attribute(
client: AppwriteClient,
database_id: str,
@@ -664,6 +678,7 @@ async def create_string_attribute(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_integer_attribute(
client: AppwriteClient,
database_id: str,
@@ -700,6 +715,7 @@ async def create_integer_attribute(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_boolean_attribute(
client: AppwriteClient,
database_id: str,
@@ -732,6 +748,7 @@ async def create_boolean_attribute(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_attribute(
client: AppwriteClient, database_id: str, collection_id: str, key: str
) -> str:
@@ -745,6 +762,7 @@ async def delete_attribute(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_indexes(
client: AppwriteClient, database_id: str, collection_id: str, queries: list[str] | None = None
) -> str:
@@ -767,6 +785,7 @@ async def list_indexes(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_index(
client: AppwriteClient,
database_id: str,
@@ -795,6 +814,7 @@ async def create_index(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_index(
client: AppwriteClient, database_id: str, collection_id: str, key: str
) -> str:

View File

@@ -16,38 +16,47 @@ from plugins.appwrite.client import AppwriteClient
# QUERY HELPERS (Appwrite 1.7.4 JSON format)
# =====================
def _query_limit(value: int) -> str:
"""Build limit query in JSON format."""
return json.dumps({"method": "limit", "values": [value]})
def _query_offset(value: int) -> str:
"""Build offset query in JSON format."""
return json.dumps({"method": "offset", "values": [value]})
def _query_order_asc(attribute: str) -> str:
"""Build orderAsc query in JSON format."""
return json.dumps({"method": "orderAsc", "values": [attribute]})
def _query_order_desc(attribute: str) -> str:
"""Build orderDesc query in JSON format."""
return json.dumps({"method": "orderDesc", "values": [attribute]})
def _query_cursor_after(document_id: str) -> str:
"""Build cursorAfter query in JSON format."""
return json.dumps({"method": "cursorAfter", "values": [document_id]})
def _query_cursor_before(document_id: str) -> str:
"""Build cursorBefore query in JSON format."""
return json.dumps({"method": "cursorBefore", "values": [document_id]})
def _query_search(attribute: str, value: str) -> str:
"""Build search query in JSON format."""
return json.dumps({"method": "search", "attribute": attribute, "values": [value]})
def _query_equal(attribute: str, values: list[Any]) -> str:
"""Build equal query in JSON format."""
return json.dumps({"method": "equal", "attribute": attribute, "values": values})
def get_tool_specifications() -> list[dict[str, Any]]:
"""Return tool specifications for ToolGenerator (12 tools)"""
return [
@@ -381,10 +390,12 @@ Each document must have:
},
]
# =====================
# HANDLER FUNCTIONS
# =====================
async def list_documents(
client: AppwriteClient, database_id: str, collection_id: str, queries: list[str] | None = None
) -> str:
@@ -407,6 +418,7 @@ async def list_documents(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_document(
client: AppwriteClient,
database_id: str,
@@ -427,6 +439,7 @@ async def get_document(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_document(
client: AppwriteClient,
database_id: str,
@@ -453,6 +466,7 @@ async def create_document(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_document(
client: AppwriteClient,
database_id: str,
@@ -479,6 +493,7 @@ async def update_document(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_document(
client: AppwriteClient, database_id: str, collection_id: str, document_id: str
) -> str:
@@ -492,6 +507,7 @@ async def delete_document(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def bulk_create_documents(
client: AppwriteClient, database_id: str, collection_id: str, documents: list[dict[str, Any]]
) -> str:
@@ -527,6 +543,7 @@ async def bulk_create_documents(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def bulk_update_documents(
client: AppwriteClient, database_id: str, collection_id: str, updates: list[dict[str, Any]]
) -> str:
@@ -562,6 +579,7 @@ async def bulk_update_documents(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def bulk_delete_documents(
client: AppwriteClient, database_id: str, collection_id: str, document_ids: list[str]
) -> str:
@@ -591,6 +609,7 @@ async def bulk_delete_documents(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def search_documents(
client: AppwriteClient,
database_id: str,
@@ -623,6 +642,7 @@ async def search_documents(
error_msg += " (Hint: Make sure you have a fulltext index on the searched attribute)"
return json.dumps({"success": False, "error": error_msg}, indent=2)
async def count_documents(
client: AppwriteClient, database_id: str, collection_id: str, queries: list[str] | None = None
) -> str:
@@ -653,6 +673,7 @@ async def count_documents(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_documents_by_ids(
client: AppwriteClient, database_id: str, collection_id: str, document_ids: list[str]
) -> str:
@@ -684,6 +705,7 @@ async def get_documents_by_ids(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_documents_paginated(
client: AppwriteClient,
database_id: str,

View File

@@ -12,6 +12,7 @@ from typing import Any
from plugins.appwrite.client import AppwriteClient
def get_tool_specifications() -> list[dict[str, Any]]:
"""Return tool specifications for ToolGenerator (14 tools)"""
return [
@@ -337,10 +338,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
]
# =====================
# HANDLER FUNCTIONS
# =====================
async def list_functions(
client: AppwriteClient, queries: list[str] | None = None, search: str | None = None
) -> str:
@@ -359,6 +362,7 @@ async def list_functions(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_function(client: AppwriteClient, function_id: str) -> str:
"""Get function by ID."""
try:
@@ -368,6 +372,7 @@ async def get_function(client: AppwriteClient, function_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_function(
client: AppwriteClient,
function_id: str,
@@ -410,6 +415,7 @@ async def create_function(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_function(
client: AppwriteClient,
function_id: str,
@@ -442,6 +448,7 @@ async def update_function(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_function(client: AppwriteClient, function_id: str) -> str:
"""Delete function."""
try:
@@ -453,6 +460,7 @@ async def delete_function(client: AppwriteClient, function_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_deployments(
client: AppwriteClient,
function_id: str,
@@ -477,6 +485,7 @@ async def list_deployments(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_deployment(client: AppwriteClient, function_id: str, deployment_id: str) -> str:
"""Get deployment by ID."""
try:
@@ -486,6 +495,7 @@ async def get_deployment(client: AppwriteClient, function_id: str, deployment_id
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_deployment(client: AppwriteClient, function_id: str, deployment_id: str) -> str:
"""Delete deployment."""
try:
@@ -498,6 +508,7 @@ async def delete_deployment(client: AppwriteClient, function_id: str, deployment
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def activate_deployment(client: AppwriteClient, function_id: str, deployment_id: str) -> str:
"""Activate deployment."""
try:
@@ -515,6 +526,7 @@ async def activate_deployment(client: AppwriteClient, function_id: str, deployme
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_active_deployment(client: AppwriteClient, function_id: str) -> str:
"""Get active deployment for function."""
try:
@@ -542,6 +554,7 @@ async def get_active_deployment(client: AppwriteClient, function_id: str) -> str
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_executions(
client: AppwriteClient,
function_id: str,
@@ -566,6 +579,7 @@ async def list_executions(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_execution(client: AppwriteClient, function_id: str, execution_id: str) -> str:
"""Get execution by ID."""
try:
@@ -575,6 +589,7 @@ async def get_execution(client: AppwriteClient, function_id: str, execution_id:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def execute_function(
client: AppwriteClient,
function_id: str,
@@ -616,6 +631,7 @@ async def execute_function(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_execution(client: AppwriteClient, function_id: str, execution_id: str) -> str:
"""Delete execution."""
try:

View File

@@ -12,6 +12,7 @@ from typing import Any
from plugins.appwrite.client import AppwriteClient
def get_tool_specifications() -> list[dict[str, Any]]:
"""Return tool specifications for ToolGenerator (12 tools)"""
return [
@@ -316,10 +317,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
]
# =====================
# HANDLER FUNCTIONS
# =====================
async def list_topics(
client: AppwriteClient, queries: list[str] | None = None, search: str | None = None
) -> str:
@@ -334,6 +337,7 @@ async def list_topics(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_topic(client: AppwriteClient, topic_id: str) -> str:
"""Get topic by ID."""
try:
@@ -343,6 +347,7 @@ async def get_topic(client: AppwriteClient, topic_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_topic(
client: AppwriteClient, topic_id: str, name: str, subscribe: list[str] | None = None
) -> str:
@@ -358,6 +363,7 @@ async def create_topic(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_topic(client: AppwriteClient, topic_id: str) -> str:
"""Delete topic."""
try:
@@ -369,6 +375,7 @@ async def delete_topic(client: AppwriteClient, topic_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_subscriber(
client: AppwriteClient, topic_id: str, subscriber_id: str, target_id: str
) -> str:
@@ -386,6 +393,7 @@ async def create_subscriber(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_subscriber(client: AppwriteClient, topic_id: str, subscriber_id: str) -> str:
"""Remove subscriber from topic."""
try:
@@ -398,6 +406,7 @@ async def delete_subscriber(client: AppwriteClient, topic_id: str, subscriber_id
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_messages(
client: AppwriteClient, queries: list[str] | None = None, search: str | None = None
) -> str:
@@ -416,6 +425,7 @@ async def list_messages(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_message(client: AppwriteClient, message_id: str) -> str:
"""Get message by ID."""
try:
@@ -425,6 +435,7 @@ async def get_message(client: AppwriteClient, message_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def send_email(
client: AppwriteClient,
message_id: str,
@@ -471,6 +482,7 @@ async def send_email(
error_msg += " (Hint: Make sure you have configured an email provider in Appwrite)"
return json.dumps({"success": False, "error": error_msg}, indent=2)
async def send_sms(
client: AppwriteClient,
message_id: str,
@@ -509,6 +521,7 @@ async def send_sms(
error_msg += " (Hint: Make sure you have configured an SMS provider in Appwrite)"
return json.dumps({"success": False, "error": error_msg}, indent=2)
async def send_push(
client: AppwriteClient,
message_id: str,
@@ -567,6 +580,7 @@ async def send_push(
)
return json.dumps({"success": False, "error": error_msg}, indent=2)
async def delete_message(client: AppwriteClient, message_id: str) -> str:
"""Delete message."""
try:

View File

@@ -11,6 +11,7 @@ from typing import Any
from plugins.appwrite.client import AppwriteClient
def get_tool_specifications() -> list[dict[str, Any]]:
"""Return tool specifications for ToolGenerator (14 tools)"""
return [
@@ -361,10 +362,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
]
# =====================
# HANDLER FUNCTIONS
# =====================
async def list_buckets(
client: AppwriteClient, queries: list[str] | None = None, search: str | None = None
) -> str:
@@ -379,6 +382,7 @@ async def list_buckets(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_bucket(client: AppwriteClient, bucket_id: str) -> str:
"""Get bucket by ID."""
try:
@@ -388,6 +392,7 @@ async def get_bucket(client: AppwriteClient, bucket_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_bucket(
client: AppwriteClient,
bucket_id: str,
@@ -424,6 +429,7 @@ async def create_bucket(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_bucket(
client: AppwriteClient,
bucket_id: str,
@@ -452,6 +458,7 @@ async def update_bucket(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_bucket(client: AppwriteClient, bucket_id: str) -> str:
"""Delete bucket."""
try:
@@ -463,6 +470,7 @@ async def delete_bucket(client: AppwriteClient, bucket_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_files(
client: AppwriteClient,
bucket_id: str,
@@ -485,6 +493,7 @@ async def list_files(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_file(client: AppwriteClient, bucket_id: str, file_id: str) -> str:
"""Get file metadata."""
try:
@@ -494,6 +503,7 @@ async def get_file(client: AppwriteClient, bucket_id: str, file_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_file(client: AppwriteClient, bucket_id: str, file_id: str) -> str:
"""Delete file."""
try:
@@ -505,6 +515,7 @@ async def delete_file(client: AppwriteClient, bucket_id: str, file_id: str) -> s
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def download_file(client: AppwriteClient, bucket_id: str, file_id: str) -> str:
"""Download file content."""
try:
@@ -524,6 +535,7 @@ async def download_file(client: AppwriteClient, bucket_id: str, file_id: str) ->
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_file_preview(
client: AppwriteClient,
bucket_id: str,
@@ -576,6 +588,7 @@ async def get_file_preview(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_file_view(client: AppwriteClient, bucket_id: str, file_id: str) -> str:
"""Get file for viewing."""
try:
@@ -595,6 +608,7 @@ async def get_file_view(client: AppwriteClient, bucket_id: str, file_id: str) ->
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_file_url(
client: AppwriteClient, bucket_id: str, file_id: str, url_type: str = "view"
) -> str:
@@ -623,6 +637,7 @@ async def get_file_url(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def bulk_delete_files(client: AppwriteClient, bucket_id: str, file_ids: list[str]) -> str:
"""Delete multiple files."""
try:
@@ -650,6 +665,7 @@ async def bulk_delete_files(client: AppwriteClient, bucket_id: str, file_ids: li
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_bucket_stats(client: AppwriteClient, bucket_id: str) -> str:
"""Get bucket statistics."""
try:

View File

@@ -11,6 +11,7 @@ from typing import Any
from plugins.appwrite.client import AppwriteClient
def get_tool_specifications() -> list[dict[str, Any]]:
"""Return tool specifications for ToolGenerator (8 tools)"""
return [
@@ -125,10 +126,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
]
# =====================
# HANDLER FUNCTIONS
# =====================
async def health_check(client: AppwriteClient) -> str:
"""Comprehensive health check of all services."""
try:
@@ -147,6 +150,7 @@ async def health_check(client: AppwriteClient) -> str:
except Exception as e:
return json.dumps({"success": False, "healthy": False, "error": str(e)}, indent=2)
async def health_db(client: AppwriteClient) -> str:
"""Check database health."""
try:
@@ -168,6 +172,7 @@ async def health_db(client: AppwriteClient) -> str:
{"success": False, "service": "database", "status": "error", "error": str(e)}, indent=2
)
async def health_cache(client: AppwriteClient) -> str:
"""Check cache health."""
try:
@@ -187,6 +192,7 @@ async def health_cache(client: AppwriteClient) -> str:
{"success": False, "service": "cache", "status": "error", "error": str(e)}, indent=2
)
async def health_storage(client: AppwriteClient) -> str:
"""Check storage health."""
try:
@@ -208,6 +214,7 @@ async def health_storage(client: AppwriteClient) -> str:
{"success": False, "service": "storage", "status": "error", "error": str(e)}, indent=2
)
async def health_queue(client: AppwriteClient) -> str:
"""Check queue health."""
try:
@@ -227,6 +234,7 @@ async def health_queue(client: AppwriteClient) -> str:
{"success": False, "service": "queue", "status": "error", "error": str(e)}, indent=2
)
async def health_time(client: AppwriteClient) -> str:
"""Check time synchronization."""
try:
@@ -251,6 +259,7 @@ async def health_time(client: AppwriteClient) -> str:
{"success": False, "service": "time", "status": "error", "error": str(e)}, indent=2
)
async def get_avatar_initials(
client: AppwriteClient,
name: str | None = None,
@@ -278,6 +287,7 @@ async def get_avatar_initials(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_qr_code(client: AppwriteClient, text: str, size: int = 400, margin: int = 1) -> str:
"""Generate QR code."""
try:

View File

@@ -11,6 +11,7 @@ from typing import Any
from plugins.appwrite.client import AppwriteClient
def get_tool_specifications() -> list[dict[str, Any]]:
"""Return tool specifications for ToolGenerator (10 tools)"""
return [
@@ -202,10 +203,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
]
# =====================
# HANDLER FUNCTIONS
# =====================
async def list_teams(
client: AppwriteClient, queries: list[str] | None = None, search: str | None = None
) -> str:
@@ -220,6 +223,7 @@ async def list_teams(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_team(client: AppwriteClient, team_id: str) -> str:
"""Get team by ID."""
try:
@@ -229,6 +233,7 @@ async def get_team(client: AppwriteClient, team_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_team(
client: AppwriteClient, team_id: str, name: str, roles: list[str] | None = None
) -> str:
@@ -244,6 +249,7 @@ async def create_team(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_team(client: AppwriteClient, team_id: str, name: str) -> str:
"""Update team name."""
try:
@@ -257,6 +263,7 @@ async def update_team(client: AppwriteClient, team_id: str, name: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_team(client: AppwriteClient, team_id: str) -> str:
"""Delete team."""
try:
@@ -268,6 +275,7 @@ async def delete_team(client: AppwriteClient, team_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_team_memberships(
client: AppwriteClient,
team_id: str,
@@ -290,6 +298,7 @@ async def list_team_memberships(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_team_membership(
client: AppwriteClient,
team_id: str,
@@ -325,6 +334,7 @@ async def create_team_membership(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_membership(
client: AppwriteClient, team_id: str, membership_id: str, roles: list[str]
) -> str:
@@ -346,6 +356,7 @@ async def update_membership(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_membership(client: AppwriteClient, team_id: str, membership_id: str) -> str:
"""Delete membership."""
try:
@@ -358,6 +369,7 @@ async def delete_membership(client: AppwriteClient, team_id: str, membership_id:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_team_prefs(client: AppwriteClient, team_id: str) -> str:
"""Get team preferences (placeholder - requires team prefs endpoint)."""
try:

View File

@@ -12,6 +12,7 @@ from typing import Any
from plugins.appwrite.client import AppwriteClient
def get_tool_specifications() -> list[dict[str, Any]]:
"""Return tool specifications for ToolGenerator (12 tools)"""
return [
@@ -220,10 +221,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
]
# =====================
# HANDLER FUNCTIONS
# =====================
async def list_users(
client: AppwriteClient, queries: list[str] | None = None, search: str | None = None
) -> str:
@@ -238,6 +241,7 @@ async def list_users(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_user(client: AppwriteClient, user_id: str) -> str:
"""Get user by ID."""
try:
@@ -247,6 +251,7 @@ async def get_user(client: AppwriteClient, user_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_user(
client: AppwriteClient,
user_id: str,
@@ -269,6 +274,7 @@ async def create_user(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_user_name(client: AppwriteClient, user_id: str, name: str) -> str:
"""Update user name."""
try:
@@ -282,6 +288,7 @@ async def update_user_name(client: AppwriteClient, user_id: str, name: str) -> s
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_user(client: AppwriteClient, user_id: str) -> str:
"""Delete user."""
try:
@@ -293,6 +300,7 @@ async def delete_user(client: AppwriteClient, user_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_user_email(client: AppwriteClient, user_id: str, email: str) -> str:
"""Update user email."""
try:
@@ -306,6 +314,7 @@ async def update_user_email(client: AppwriteClient, user_id: str, email: str) ->
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_user_phone(client: AppwriteClient, user_id: str, number: str) -> str:
"""Update user phone."""
try:
@@ -319,6 +328,7 @@ async def update_user_phone(client: AppwriteClient, user_id: str, number: str) -
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_user_status(client: AppwriteClient, user_id: str, status: bool) -> str:
"""Update user status (enable/disable)."""
try:
@@ -333,6 +343,7 @@ async def update_user_status(client: AppwriteClient, user_id: str, status: bool)
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_user_labels(client: AppwriteClient, user_id: str, labels: list[str]) -> str:
"""Update user labels."""
try:
@@ -346,6 +357,7 @@ async def update_user_labels(client: AppwriteClient, user_id: str, labels: list[
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_user_sessions(client: AppwriteClient, user_id: str) -> str:
"""List user sessions."""
try:
@@ -363,6 +375,7 @@ async def list_user_sessions(client: AppwriteClient, user_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_user_sessions(client: AppwriteClient, user_id: str) -> str:
"""Delete all user sessions."""
try:
@@ -374,6 +387,7 @@ async def delete_user_sessions(client: AppwriteClient, user_id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_user_session(client: AppwriteClient, user_id: str, session_id: str) -> str:
"""Delete a specific session."""
try:

View File

@@ -14,6 +14,7 @@ from plugins.appwrite import handlers
from plugins.appwrite.client import AppwriteClient
from plugins.base import BasePlugin
class AppwritePlugin(BasePlugin):
"""
Appwrite Self-Hosted Plugin - Complete backend management.