33 lines
761 B
Python
33 lines
761 B
Python
"""Request/response models for the HTTP API."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class SpeakRequest(BaseModel):
|
|
text: str = Field(..., description="What the robot should say.")
|
|
voice: Optional[str] = Field(None, description="Optional voice id, if the robot supports it.")
|
|
language: Optional[str] = Field(None, description="Optional language/locale hint.")
|
|
|
|
|
|
class SpeakResponse(BaseModel):
|
|
success: bool
|
|
status: str
|
|
requestId: str
|
|
text: str
|
|
ackLatencyMs: Optional[int] = None
|
|
|
|
|
|
class SimpleResponse(BaseModel):
|
|
success: bool
|
|
status: Optional[str] = None
|
|
|
|
|
|
class ErrorResponse(BaseModel):
|
|
success: bool = False
|
|
error: str
|
|
errorCode: str
|