# API Contracts: SvelteKit Frontend

The SvelteKit frontend will interact with the following existing backend API endpoints.

## Settings API (`/api/settings`)

### Get All Settings
- **Endpoint**: `GET /api/settings/`
- **Response**: `AppConfig` (JSON)
- **Usage**: Load initial configuration for the application.

### Update Global Settings
- **Endpoint**: `PATCH /api/settings/global`
- **Request Body**: `GlobalSettings` (JSON)
- **Response**: `GlobalSettings` (JSON)
- **Usage**: Save changes to global settings.

### List Environments
- **Endpoint**: `GET /api/settings/environments`
- **Response**: `List[Environment]` (JSON)
- **Usage**: Display configured Superset environments.

### Add Environment
- **Endpoint**: `POST /api/settings/environments`
- **Request Body**: `Environment` (JSON)
- **Response**: `Environment` (JSON)
- **Usage**: Create a new environment configuration.

### Update Environment
- **Endpoint**: `PUT /api/settings/environments/{id}`
- **Request Body**: `Environment` (JSON)
- **Response**: `Environment` (JSON)
- **Usage**: Modify an existing environment.

### Delete Environment
- **Endpoint**: `DELETE /api/settings/environments/{id}`
- **Response**: `{"message": "..."}`
- **Usage**: Remove an environment.

### Test Connection
- **Endpoint**: `POST /api/settings/environments/{id}/test`
- **Response**: `{"status": "success/error", "message": "..."}`
- **Usage**: Verify connectivity to a Superset instance.

## Plugins API (`/api/plugins`)

### List Plugins
- **Endpoint**: `GET /api/plugins/`
- **Response**: `List[PluginConfig]` (JSON)
- **Usage**: Display available plugins on the Dashboard.

## Tasks API (`/api/tasks`)
*(Inferred from file list, used for running plugin tasks)*

### List Tasks
- **Endpoint**: `GET /api/tasks/`
- **Usage**: Show active or historical tasks.

### Run Task
- **Endpoint**: `POST /api/tasks/{plugin_id}`
- **Usage**: Execute a plugin-specific task.
