/** * Type definitions mirroring the FFmpeg Micro REST API. * These are hand-maintained rather than generated for v0.1.0 to keep the repo * simple. They can be switched to openapi-typescript output later if the API * surface grows. */ /** * The statuses the API can actually return, matching the jobs table's CHECK * constraint exactly: * * CHECK (status = ANY (ARRAY['pending','processing','completed','failed','canceled'])) * * Note "canceled", one L. The API uses the American spelling; the British one * silently matches nothing. */ export type TranscodeStatus = "pending" | "processing" | "completed" | "failed" | "canceled"; export type OutputFormat = "mp4" | "webm" | "mov"; export type QualityPreset = "high" | "medium" | "low"; export type ResolutionPreset = "480p" | "720p" | "1080p" | "4k"; export interface Input { url: string; } export interface Preset { quality?: QualityPreset; resolution?: ResolutionPreset; } export interface FfmpegOption { option: string; argument: string | Record; } export interface CreateTranscodeRequest { inputs: Input[]; outputFormat: OutputFormat; preset?: Preset; options?: FfmpegOption[]; } export interface Transcode { id: string; status: TranscodeStatus; output_format?: string; output_url?: string | null; created_at: string; updated_at?: string; duration_seconds?: number; billable_minutes?: number; [key: string]: unknown; } export interface ListTranscodesResponse { items: Transcode[]; page: number; limit: number; total: number; } export interface CancelTranscodeResponse { success: boolean; message: string; job: Transcode; } export interface DownloadUrlResponse { url: string; } export type TranscribeTask = "transcribe" | "translate"; export interface CreateTranscribeRequest { media_url: string; language?: string; task?: TranscribeTask; } export interface Transcribe { id: string; status: TranscodeStatus; media_url?: string; output_format?: "srt"; output_url?: string | null; error_message?: string | null; created_at: string; completed_at?: string | null; [key: string]: unknown; } export type BlueprintRunStatus = "pending" | "processing" | "awaiting_review" | "completed" | "failed"; export interface BlueprintOutput { label: string; url: string; } /** * A blueprint run. NOTE: unlike /v1/transcodes and /v1/upload, the blueprint * routes return plain bodies (no {success, result} envelope). */ export interface BlueprintRun { id: string; blueprint: string; status: BlueprintRunStatus; step?: string | null; /** Signed URL (10-min TTL). Single-output blueprints. */ output_url?: string | null; /** Multi-output blueprints (listing-kit, hook-variants). Prefer over output_url when present. */ outputs?: BlueprintOutput[]; error_message?: string | null; tokens_charged?: number; tokens_spent?: number; /** Present when status is awaiting_review (caption-video transcript review). */ srt_text?: string; created_at?: string; completed_at?: string | null; [key: string]: unknown; } export interface PresignedUploadUrlRequest { filename: string; contentType: string; fileSize: number; } export interface PresignedUploadUrlResult { uploadUrl: string; filename: string; expiresAt: string; } export interface PresignedUploadUrlResponse { success: boolean; result: PresignedUploadUrlResult; } export interface ConfirmUploadRequest { filename: string; fileSize: number; uploadId?: string; } export interface ConfirmUploadResult { fileUrl: string; downloadUrl?: string; filename: string; fileSize: number; uploadedAt: string; metadata?: Record; } export interface ConfirmUploadResponse { success: boolean; result: ConfirmUploadResult; }