2026-06-29 01:18:46 +02:00
|
|
|
"""Pydantic schemas for plugin API responses."""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PluginInfo(BaseModel):
|
|
|
|
|
"""Plugin status information returned in list endpoint."""
|
|
|
|
|
|
|
|
|
|
name: str
|
|
|
|
|
display_name: str
|
|
|
|
|
version: str
|
|
|
|
|
status: str = Field(description="discovered | installed | active | inactive")
|
|
|
|
|
installed: bool = False
|
|
|
|
|
active: bool = False
|
|
|
|
|
description: str = ""
|
|
|
|
|
dependencies: list[str] = Field(default_factory=list)
|
|
|
|
|
events: list[str] = Field(default_factory=list)
|
|
|
|
|
migrations: list[str] = Field(default_factory=list)
|
|
|
|
|
permissions: list[str] = Field(default_factory=list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PluginListResponse(BaseModel):
|
|
|
|
|
"""Response for GET /api/v1/plugins."""
|
|
|
|
|
|
|
|
|
|
plugins: list[PluginInfo]
|
|
|
|
|
total: int
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PluginActionResponse(BaseModel):
|
|
|
|
|
"""Response for install/activate/deactivate/uninstall actions."""
|
|
|
|
|
|
|
|
|
|
name: str
|
|
|
|
|
display_name: str
|
|
|
|
|
version: str
|
|
|
|
|
status: str
|
|
|
|
|
installed: bool = False
|
|
|
|
|
active: bool = False
|
2026-06-29 17:43:56 +02:00
|
|
|
dropped_tables: list[str] = Field(
|
|
|
|
|
default_factory=list, description="Tables dropped (uninstall with remove_data=true)"
|
|
|
|
|
)
|
2026-06-29 01:18:46 +02:00
|
|
|
message: str = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PluginUninstallResponse(PluginActionResponse):
|
|
|
|
|
"""Response for DELETE /api/v1/plugins/{name}."""
|
|
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ManifestFieldDoc(BaseModel):
|
|
|
|
|
"""Documentation for a single manifest field."""
|
2026-06-29 17:43:56 +02:00
|
|
|
|
2026-06-29 01:18:46 +02:00
|
|
|
type: str
|
|
|
|
|
required: str
|
|
|
|
|
description: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ManifestSchemaResponse(BaseModel):
|
|
|
|
|
"""Response for GET /api/v1/plugins/manifest."""
|
|
|
|
|
|
|
|
|
|
fields: dict[str, ManifestFieldDoc]
|
|
|
|
|
example: dict
|