mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-03 20:56:18 +02:00
- New APIBrowser component with full OpenAPI schema integration
- Fetches and parses /openapi.json automatically
- Groups endpoints by API tags (printers, archives, settings, etc.)
- Expandable endpoint sections with color-coded method badges
- Path parameter, query parameter, and JSON body editors
- Auto-populates request body with schema examples
- Live API request execution with response display
- Response shows status code, timing, and formatted JSON
- Copy response button with clipboard fallback
- Search to filter endpoints across all categories
- Expand All / Collapse All buttons
- Link to Swagger UI (/docs)
- Two-column layout for API Keys tab
- Left: API key management + webhook documentation
- Right: API Browser with dedicated test key input
- Parameter validation
- Shows warning for missing required parameters
- Validates before sending requests to avoid 422 errors
- UX improvements
- "Use in API Browser" button on newly created keys
- Responsive layout (stacked on mobile, side-by-side on xl+)
57 lines
1.4 KiB
Python
57 lines
1.4 KiB
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class FilamentBase(BaseModel):
|
|
name: str = Field(..., min_length=1, max_length=100)
|
|
type: str = Field(..., min_length=1, max_length=50)
|
|
brand: str | None = None
|
|
color: str | None = None
|
|
color_hex: str | None = Field(None, pattern=r"^#[0-9A-Fa-f]{6}$")
|
|
cost_per_kg: float = 25.0
|
|
spool_weight_g: float = 1000.0
|
|
currency: str = "USD"
|
|
density: float | None = None
|
|
print_temp_min: int | None = None
|
|
print_temp_max: int | None = None
|
|
bed_temp_min: int | None = None
|
|
bed_temp_max: int | None = None
|
|
|
|
|
|
class FilamentCreate(FilamentBase):
|
|
pass
|
|
|
|
|
|
class FilamentUpdate(BaseModel):
|
|
name: str | None = None
|
|
type: str | None = None
|
|
brand: str | None = None
|
|
color: str | None = None
|
|
color_hex: str | None = None
|
|
cost_per_kg: float | None = None
|
|
spool_weight_g: float | None = None
|
|
currency: str | None = None
|
|
density: float | None = None
|
|
print_temp_min: int | None = None
|
|
print_temp_max: int | None = None
|
|
bed_temp_min: int | None = None
|
|
bed_temp_max: int | None = None
|
|
|
|
|
|
class FilamentResponse(FilamentBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class FilamentCostCalculation(BaseModel):
|
|
filament_id: int
|
|
filament_name: str
|
|
weight_grams: float
|
|
cost: float
|
|
currency: str
|