Metadata-Version: 2.1
Name: nested-chat-plugin-sdk
Version: 0.1.3
Summary: Test
Author: vladvavilov
Author-email: vladvav94@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: fastapi (>=0.103.0,<0.104.0)
Requires-Dist: httpx (>=0.27.0,<0.28.0)
Requires-Dist: pydantic-settings (>=2.0.3,<3.0.0)
Description-Content-Type: text/markdown



# Plugin SDK for FastAPI

The Plugin SDK nested-chat-plugin-sdk is a FastAPI extension that provides a convenient way to handle requests for creating, updating, deleting, and executing operations.

## Installation

Install dependencies using Poetry and activate the virtual environment. [Learn how to install Poetry](https://python-poetry.org/docs/)

```bash
poetry install
poetry shell
````

Install the SDK using [Poetry](https://python-poetry.org/):

```bash
poetry add nested-chat-plugin-sdk
```

## Example
```python
from fastapi import FastAPI, Request
from nested_chat_plugin_sdk.sdk import PluginRouter, SyncRequest

app = FastAPI()
plugin_router = PluginRouter(api_url="")

@plugin_router.on_create
async def handle_create(data: SyncRequest):
    print("create", data)

@plugin_router.on_update
async def handle_update(data: SyncRequest):
    print("update", data)

@plugin_router.on_delete
async def handle_delete(data: SyncRequest):
    print("delete", data)

@plugin_router.on_execute
async def handle_execute(request: Request):
    print("execute", request)

app.include_router(plugin_router)

```

## API Routes

### `/sync`

- `POST`: Create data
- `PUT`: Update data
- `DELETE`: Delete data

### `/execute`

- `POST`: Execute operation

## SyncRequest Schema

```python
from nested_chat_plugin_sdk.schemes import SyncRequest

class SyncRequest(BaseModel):
    project: dict[str, Any]
    core: dict[str, Any]
    variable: dict[str, Any]
    variable_enum_item: dict[str, Any] = {}
    variable_group: str | None = None


```




