# Copyright (C) 2025 AIDC-AI # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Frame/Template rendering API schemas """ from typing import Optional from pydantic import BaseModel, Field class FrameRenderRequest(BaseModel): """Frame rendering request""" template: str = Field( ..., description="Template key (e.g., '1080x1920/default.html'). Can also be just filename (e.g., 'default.html') to use default size." ) title: Optional[str] = Field(None, description="Frame title (optional)") text: str = Field(..., description="Frame text content") image: str = Field(..., description="Image path or URL") class Config: json_schema_extra = { "example": { "template": "1080x1920/default.html", "title": "Sample Title", "text": "This is a sample text for the frame.", "image": "resources/example.png" } } class FrameRenderResponse(BaseModel): """Frame rendering response""" success: bool = True message: str = "Success" frame_path: str = Field(..., description="Path to generated frame image") width: int = Field(..., description="Frame width in pixels") height: int = Field(..., description="Frame height in pixels")