UNPKG

primvoices

Version:

TypeScript client for the Prim Voices API

41 lines (40 loc) 1.53 kB
import { AxiosInstance } from "axios"; import { APIResponse, GenerationResponse, GenerationCreateParams, PaginationParams } from "../types"; export declare class GenerationsAPI { private readonly client; constructor(client: AxiosInstance); /** * List all generations for the authenticated user * GET /v1/generations */ list(params?: PaginationParams): Promise<APIResponse<GenerationResponse[]>>; /** * Get a specific generation by ID * GET /v1/generations/:id */ retrieve(generationId: string): Promise<APIResponse<GenerationResponse>>; /** * Create a new generation * POST /v1/generations * * @param params.voiceId - ID of the voice to use * @param params.text - Text to generate (required for low/medium/high quality) * @param params.sourceUrl - Source audio URL (required for voice quality) * @param params.notes - Optional notes for generation style * @param params.quality - Quality level (low/medium/high/voice) * * @throws {ErrorResponse} When: * - quality is not provided * - voiceId is not provided * - text is not provided for low/medium/high quality * - sourceUrl is not provided for voice quality * - voice is not found * - insufficient balance */ create(params: GenerationCreateParams): Promise<APIResponse<GenerationResponse>>; /** * Delete a generation * DELETE /v1/generations/:id */ delete(generationId: string): Promise<APIResponse<void>>; }