UNPKG

@tsavo/creatify-api-ts

Version:

TypeScript client for the Creatify AI API

585 lines (572 loc) 26.9 kB
import { C as CreatifyApiOptions, b as CreatifyApiClientFactory, A as Avatar, U as UrlToVideo, T as TextToSpeech, d as AiEditing, g as CustomTemplates, D as DYOA, e as AiShorts, f as AiScripts, M as Musics, W as Workspace, L as LipsyncV2 } from '../client-factory-BpS2ubWp.mjs'; /** * Client for interacting with the Creatify AI Avatar API * @see https://creatify.mintlify.app/api-reference/lipsync */ declare class AvatarApi { private client; /** * Create a new AvatarApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Get a list of all available avatars * @returns Promise resolving to an array of avatar information * @see https://creatify.mintlify.app/api-reference/personas/get-apipersonas */ getAvatars(filters?: { age_range?: 'child' | 'teen' | 'adult' | 'senior'; gender?: 'm' | 'f' | 'nb'; location?: 'outdoor' | 'fantasy' | 'indoor' | 'other'; style?: 'selfie' | 'presenter' | 'other'; }): Promise<Avatar.AvatarInfo[]>; /** * Get a list of available avatars with pagination * @param page Page number (starts from 1) * @param limit Number of items per page * @param filters Optional filtering parameters * @returns Promise resolving to paginated avatar information * @see https://creatify.mintlify.app/api-reference/personas/get-apipersonas-paginated */ getAvatarsPaginated(page?: number, limit?: number, filters?: { age_range?: 'child' | 'teen' | 'adult' | 'senior'; gender?: 'm' | 'f' | 'nb'; location?: 'outdoor' | 'fantasy' | 'indoor' | 'other'; style?: 'selfie' | 'presenter' | 'other'; }): Promise<{ count: number; next: string | null; previous: string | null; results: Avatar.AvatarInfo[]; }>; /** * Get a list of all available voices * @returns Promise resolving to an array of voice information * @see https://creatify.mintlify.app/api-reference/voices/get-apivoices */ getVoices(): Promise<Avatar.VoiceInfo[]>; /** * Create a lipsync video with an AI avatar speaking the provided text * @param params Parameters for the lipsync video generation * @returns Promise resolving to the lipsync task response * @see https://creatify.mintlify.app/api-reference/lipsync */ createLipsync(params: Avatar.LipsyncParams): Promise<Avatar.LipsyncResponse>; /** * Get the status and result of a lipsync task * @param id ID of the lipsync task * @returns Promise resolving to the lipsync task status and result * @see https://creatify.mintlify.app/api-reference/lipsync */ getLipsync(id: string): Promise<Avatar.LipsyncResultResponse>; /** * Get all lipsync tasks * @returns Promise resolving to an array of lipsync tasks * @see https://creatify.mintlify.app/api-reference/lipsync */ getLipsyncs(): Promise<Avatar.LipsyncResultResponse[]>; /** * Create a multi-avatar lipsync video with multiple AI avatars speaking * @param params Parameters for the multi-avatar lipsync video generation * @returns Promise resolving to the lipsync task response * @see https://creatify.mintlify.app/api-reference/lipsync-multi-avatar */ createMultiAvatarLipsync(params: Avatar.MultiAvatarLipsyncParams): Promise<Avatar.LipsyncResponse>; /** * Create a lipsync video and wait for it to complete * @param params Parameters for the lipsync video generation * @param pollInterval How often to check status in ms (default 2000) * @param maxAttempts Maximum number of polling attempts (default 30) * @returns Promise resolving to the completed lipsync task */ createAndWaitForLipsync(params: Avatar.LipsyncParams, pollInterval?: number, maxAttempts?: number): Promise<Avatar.LipsyncResultResponse>; } /** * Client for interacting with the Creatify URL-to-Video API * @see https://creatify.mintlify.app/api-reference/link-to-video */ declare class UrlToVideoApi { private client; /** * Create a new UrlToVideoApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Create a link from a URL * @param params Parameters containing the URL * @returns Promise resolving to the link response * @see https://creatify.mintlify.app/api-reference/links/post-apilinks */ createLink(params: UrlToVideo.LinkParams): Promise<UrlToVideo.LinkResponse>; /** * Create a link with custom parameters * @param params Custom link parameters * @returns Promise resolving to the link response * @see https://creatify.mintlify.app/api-reference/links/post-apilink_with_params */ createLinkWithParams(params: UrlToVideo.CustomLinkParams): Promise<UrlToVideo.LinkResponse>; /** * Update an existing link * @param id ID of the link to update * @param params New link parameters * @returns Promise resolving to the updated link data * @see https://creatify.mintlify.app/api-reference/links/put-apilinks- */ updateLink(id: string, params: Partial<UrlToVideo.CustomLinkParams> & { url?: string; }): Promise<UrlToVideo.LinkData>; /** * Get an existing link by ID * @param id ID of the link to get * @returns Promise resolving to the link data * @see https://creatify.mintlify.app/api-reference/links/get-apilinks- */ getLink(id: string): Promise<UrlToVideo.LinkData>; /** * Get all existing links * @param page Page number (starts from 1) * @param limit Number of items per page * @returns Promise resolving to an array of link data * @see https://creatify.mintlify.app/api-reference/links/get-apilinks */ getLinks(page?: number, limit?: number): Promise<UrlToVideo.LinkData[]>; /** * Get paginated list of links * @param page Page number (starts from 1) * @param limit Number of items per page * @returns Promise resolving to paginated link data * @see https://creatify.mintlify.app/api-reference/links/get-apilinks-paginated */ getLinksPaginated(page?: number, limit?: number): Promise<{ count: number; next: string | null; previous: string | null; results: UrlToVideo.LinkData[]; }>; /** * Create a video from a link * @param params Parameters for video generation * @returns Promise resolving to the video response * @see https://creatify.mintlify.app/api-reference/link-to-video */ createVideoFromLink(params: UrlToVideo.VideoFromLinkParams): Promise<UrlToVideo.VideoResponse>; /** * Get the status and result of a video generation task * @param id ID of the video task * @returns Promise resolving to the video status and result * @see https://creatify.mintlify.app/api-reference/link-to-video */ getVideo(id: string): Promise<UrlToVideo.VideoResultResponse>; /** * Get all video generation tasks * @returns Promise resolving to an array of video tasks * @see https://creatify.mintlify.app/api-reference/link-to-video */ getVideos(): Promise<UrlToVideo.VideoResultResponse[]>; } /** * Client for interacting with the Creatify Text-to-Speech API * @see https://creatify.mintlify.app/api-reference/text-to-speech */ declare class TextToSpeechApi { private client; /** * Create a new TextToSpeechApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Create a text-to-speech task to convert text into an audio file * @param params Parameters for the text-to-speech generation * @returns Promise resolving to the text-to-speech task response * @see https://creatify.mintlify.app/api-reference/text-to-speech/post-text-to-speech */ createTextToSpeech(params: TextToSpeech.TextToSpeechParams): Promise<TextToSpeech.TextToSpeechResponse>; /** * Get the status and result of a text-to-speech task * @param id ID of the text-to-speech task * @returns Promise resolving to the text-to-speech task status and result * @see https://creatify.mintlify.app/api-reference/text-to-speech/get-text-to-speech- */ getTextToSpeech(id: string): Promise<TextToSpeech.TextToSpeechResultResponse>; /** * Get all text-to-speech tasks * @param page Page number (starts from 1) * @param limit Number of items per page * @returns Promise resolving to an array of text-to-speech tasks * @see https://creatify.mintlify.app/api-reference/text-to-speech/get-text-to-speech */ getTextToSpeechList(page?: number, limit?: number): Promise<TextToSpeech.TextToSpeechResultResponse[]>; /** * Get paginated list of text-to-speech tasks * @param page Page number (starts from 1) * @param limit Number of items per page * @returns Promise resolving to paginated text-to-speech data * @see https://creatify.mintlify.app/api-reference/text-to-speech/get-text-to-speech */ getTextToSpeechPaginated(page?: number, limit?: number): Promise<{ count: number; next: string | null; previous: string | null; results: TextToSpeech.TextToSpeechResultResponse[]; }>; /** * Helper method to create a text-to-speech and wait for completion * @param params Parameters for the text-to-speech generation * @param pollInterval Interval in milliseconds to check for completion (default: 5000) * @param maxAttempts Maximum number of polling attempts (default: 60, about 5 minutes) * @returns Promise resolving to the final text-to-speech result */ createAndWaitForTextToSpeech(params: TextToSpeech.TextToSpeechParams, pollInterval?: number, maxAttempts?: number): Promise<TextToSpeech.TextToSpeechResultResponse>; } /** * Client for interacting with the Creatify AI Editing API * @see https://creatify.mintlify.app/api-reference/ai-editing */ declare class AiEditingApi { private client; /** * Create a new AiEditingApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Create an AI editing task to edit a video with AI * @param params Parameters for the AI editing task * @returns Promise resolving to the AI editing task response * @see https://creatify.mintlify.app/api-reference/ai-editing */ createAiEditing(params: AiEditing.AiEditingParams): Promise<AiEditing.AiEditingResponse>; /** * Get the status and result of an AI editing task * @param id ID of the AI editing task * @returns Promise resolving to the AI editing task status and result * @see https://creatify.mintlify.app/api-reference/ai-editing */ getAiEditing(id: string): Promise<AiEditing.AiEditingResultResponse>; /** * Get all AI editing tasks * @returns Promise resolving to an array of AI editing tasks * @see https://creatify.mintlify.app/api-reference/ai-editing */ getAiEditingList(): Promise<AiEditing.AiEditingResultResponse[]>; /** * Helper method to create an AI editing task and wait for completion * @param params Parameters for the AI editing task * @param pollInterval Interval in milliseconds to check for completion (default: 5000) * @param maxAttempts Maximum number of polling attempts (default: 120, about 10 minutes) * @returns Promise resolving to the final AI editing result */ createAndWaitForAiEditing(params: AiEditing.AiEditingParams, pollInterval?: number, maxAttempts?: number): Promise<AiEditing.AiEditingResultResponse>; } /** * Client for interacting with the Creatify Custom Templates API * @see https://creatify.mintlify.app/api-reference/custom-templates */ declare class CustomTemplatesApi { private client; /** * Create a new CustomTemplatesApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Create a video using a custom template * @param params Parameters for the custom template video generation * @returns Promise resolving to the custom template task response * @see https://creatify.mintlify.app/api-reference/custom-templates */ createCustomTemplate(params: CustomTemplates.CustomTemplateParams): Promise<CustomTemplates.CustomTemplateResponse>; /** * Get the status and result of a custom template task * @param id ID of the custom template task * @returns Promise resolving to the custom template task status and result * @see https://creatify.mintlify.app/api-reference/custom-templates */ getCustomTemplate(id: string): Promise<CustomTemplates.CustomTemplateResultResponse>; /** * Get all custom template tasks * @returns Promise resolving to an array of custom template tasks * @see https://creatify.mintlify.app/api-reference/custom-templates */ getCustomTemplateList(): Promise<CustomTemplates.CustomTemplateResultResponse[]>; /** * Helper method to create a custom template video and wait for completion * @param params Parameters for the custom template video generation * @param pollInterval Interval in milliseconds to check for completion (default: 5000) * @param maxAttempts Maximum number of polling attempts (default: 120, about 10 minutes) * @returns Promise resolving to the final custom template result */ createAndWaitForCustomTemplate(params: CustomTemplates.CustomTemplateParams, pollInterval?: number, maxAttempts?: number): Promise<CustomTemplates.CustomTemplateResultResponse>; } /** * Client for interacting with the Creatify DYOA (Design Your Own Avatar) API * @see https://creatify.mintlify.app/api-reference/introduction */ declare class DyoaApi { private client; /** * Create a new DyoaApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Create a DYOA with avatar details * @param params Parameters for the DYOA creation * @returns Promise resolving to the DYOA response * @see https://creatify.mintlify.app/api-reference/introduction */ createDyoa(params: DYOA.DyoaParams): Promise<DYOA.DyoaResponse>; /** * Get a DYOA by ID * @param id ID of the DYOA * @returns Promise resolving to the DYOA details * @see https://creatify.mintlify.app/api-reference/introduction */ getDyoa(id: string): Promise<DYOA.DyoaResponse>; /** * Get all DYOAs * @returns Promise resolving to an array of DYOAs * @see https://creatify.mintlify.app/api-reference/introduction */ getDyoaList(): Promise<DYOA.DyoaResponse[]>; /** * Submit a DYOA for review with the chosen photo * @param id ID of the DYOA * @param params Parameters for the DYOA submission * @returns Promise resolving to the updated DYOA details * @see https://creatify.mintlify.app/api-reference/introduction */ submitDyoaForReview(id: string, params: DYOA.DyoaSubmitParams): Promise<DYOA.DyoaResponse>; /** * Delete a DYOA * @param id ID of the DYOA to delete * @returns Promise resolving to the deletion response * @see https://creatify.mintlify.app/api-reference/introduction */ deleteDyoa(id: string): Promise<void>; /** * Helper method to create a DYOA and wait for photos to be generated * @param params Parameters for the DYOA creation * @param pollInterval Interval in milliseconds to check for photo generation (default: 10000) * @param maxAttempts Maximum number of polling attempts (default: 30, about 5 minutes) * @returns Promise resolving to the DYOA with generated photos */ createAndWaitForDyoaPhotos(params: DYOA.DyoaParams, pollInterval?: number, maxAttempts?: number): Promise<DYOA.DyoaResponse>; /** * Helper method to create a DYOA, wait for photos, submit for review and wait for approval * @param createParams Parameters for the DYOA creation * @param photoIndex Index of the photo to choose (defaults to 0, the first photo) * @param photoGenPollInterval Interval in ms to check for photo generation (default: 10000) * @param photoGenMaxAttempts Maximum polling attempts for photos (default: 30) * @param reviewPollInterval Interval in ms to check for review completion (default: 60000) * @param reviewMaxAttempts Maximum polling attempts for review (default: 60, about 1 hour) * @returns Promise resolving to the approved DYOA */ createSubmitAndWaitForDyoa(createParams: DYOA.DyoaParams, photoIndex?: number, photoGenPollInterval?: number, photoGenMaxAttempts?: number, reviewPollInterval?: number, reviewMaxAttempts?: number): Promise<DYOA.DyoaResponse>; } /** * Client for interacting with the Creatify AI Shorts API * @see https://creatify.mintlify.app/api-reference/ai-shorts */ declare class AiShortsApi { private client; /** * Create a new AiShortsApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Create an AI Shorts task to generate a video from a text prompt * @param params Parameters for the AI Shorts task * @returns Promise resolving to the AI Shorts task response * @see https://creatify.mintlify.app/api-reference/ai-shorts/post-ai-shorts */ createAiShorts(params: AiShorts.AiShortsParams): Promise<AiShorts.AiShortsResponse>; /** * Get the status and result of an AI Shorts task * @param id ID of the AI Shorts task * @returns Promise resolving to the AI Shorts task status and result * @see https://creatify.mintlify.app/api-reference/ai-shorts/get-ai-shorts- */ getAiShorts(id: string): Promise<AiShorts.AiShortsResultResponse>; /** * Get all AI Shorts tasks * @returns Promise resolving to an array of AI Shorts tasks * @see https://creatify.mintlify.app/api-reference/ai-shorts/get-ai-shorts */ getAiShortsList(): Promise<AiShorts.AiShortsResultResponse[]>; /** * Generate a preview of an AI Shorts video * @param id ID of the AI Shorts task * @returns Promise resolving to the AI Shorts task response * @see https://creatify.mintlify.app/api-reference/ai-shorts/post-ai-shorts-preview */ generateAiShortsPreview(id: string): Promise<AiShorts.AiShortsResponse>; /** * Render an AI Shorts video * @param id ID of the AI Shorts task * @returns Promise resolving to the AI Shorts task response * @see https://creatify.mintlify.app/api-reference/ai-shorts/post-ai-shorts-render */ renderAiShorts(id: string): Promise<AiShorts.AiShortsResponse>; /** * Create an AI Shorts video and wait for it to complete * @param params Parameters for the AI Shorts video generation * @param pollInterval How often to check status in ms (default 2000) * @param maxAttempts Maximum number of polling attempts (default 30) * @returns Promise resolving to the completed AI Shorts task */ createAndWaitForAiShorts(params: AiShorts.AiShortsParams, pollInterval?: number, maxAttempts?: number): Promise<AiShorts.AiShortsResultResponse>; } /** * Client for interacting with the Creatify AI Scripts API * @see https://creatify.mintlify.app/api-reference/ai-scripts */ declare class AiScriptsApi { private client; /** * Create a new AiScriptsApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Generate an AI Script from a text prompt * @param params Parameters for the AI Script generation * @returns Promise resolving to the AI Script task response * @see https://creatify.mintlify.app/api-reference/ai-scripts/post-ai-scripts */ createAiScript(params: AiScripts.AiScriptsParams): Promise<AiScripts.AiScriptsResponse>; /** * Get the status and result of an AI Script task * @param id ID of the AI Script task * @returns Promise resolving to the AI Script task status and result * @see https://creatify.mintlify.app/api-reference/ai-scripts/get-ai-scripts- */ getAiScript(id: string): Promise<AiScripts.AiScriptsResultResponse>; /** * Get all AI Script tasks * @returns Promise resolving to an array of AI Script tasks * @see https://creatify.mintlify.app/api-reference/ai-scripts/get-ai-scripts */ getAiScriptsList(): Promise<AiScripts.AiScriptsResultResponse[]>; /** * Create an AI Script and wait for it to complete * @param params Parameters for the AI Script generation * @param pollInterval How often to check status in ms (default 2000) * @param maxAttempts Maximum number of polling attempts (default 30) * @returns Promise resolving to the completed AI Script task */ createAndWaitForAiScript(params: AiScripts.AiScriptsParams, pollInterval?: number, maxAttempts?: number): Promise<AiScripts.AiScriptsResultResponse>; } /** * Client for interacting with the Creatify Musics API * @see https://creatify.mintlify.app/api-reference/musics */ declare class MusicsApi { private client; /** * Create a new MusicsApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Get a list of all available music categories * @returns Promise resolving to an array of music categories * @see https://creatify.mintlify.app/api-reference/musics/get-api-music-categories */ getMusicCategories(): Promise<Musics.MusicCategory[]>; /** * Get a list of all available music tracks * @param category Optional category to filter by * @returns Promise resolving to an array of music tracks * @see https://creatify.mintlify.app/api-reference/musics/get-api-musics */ getMusics(category?: string): Promise<Musics.MusicTrack[]>; } /** * Client for interacting with the Creatify Workspace API * @see https://creatify.mintlify.app/api-reference/workspace */ declare class WorkspaceApi { private client; /** * Create a new WorkspaceApi instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Get the remaining credits for the current workspace * @returns Promise resolving to the remaining credits * @see https://creatify.mintlify.app/api-reference/workspace/get-remainingcredits */ getRemainingCredits(): Promise<Workspace.RemainingCreditsResponse>; } /** * Client for interacting with the Creatify Lipsync v2 API * @see https://creatify.mintlify.app/api-reference/lipsyncs_v2 */ declare class LipsyncV2Api { private client; /** * Create a new LipsyncV2Api instance * @param options API client options * @param clientFactory Optional factory for creating API clients (useful for testing) */ constructor(options: CreatifyApiOptions, clientFactory?: CreatifyApiClientFactory); /** * Create a lipsync v2 video with multiple AI avatars speaking * @param params Parameters for the lipsync v2 video generation * @returns Promise resolving to the lipsync v2 task response * @see https://creatify.mintlify.app/api-reference/lipsyncs_v2/post-apilipsyncs */ createLipsyncV2(params: LipsyncV2.LipsyncV2Params): Promise<LipsyncV2.LipsyncV2Response>; /** * Get the status and result of a lipsync v2 task * @param id ID of the lipsync v2 task * @returns Promise resolving to the lipsync v2 task status and result * @see https://creatify.mintlify.app/api-reference/lipsyncs_v2/get-apilipsyncs- */ getLipsyncV2(id: string): Promise<LipsyncV2.LipsyncV2ResultResponse>; /** * Get all lipsync v2 tasks * @returns Promise resolving to an array of lipsync v2 tasks * @see https://creatify.mintlify.app/api-reference/lipsyncs_v2/get-apilipsyncs */ getLipsyncsV2(): Promise<LipsyncV2.LipsyncV2ResultResponse[]>; /** * Generate a preview of a lipsync v2 video * @param id ID of the lipsync v2 task * @returns Promise resolving to the lipsync v2 task response * @see https://creatify.mintlify.app/api-reference/lipsyncs_v2/post-apilipsyncs-preview */ generateLipsyncV2Preview(id: string): Promise<LipsyncV2.LipsyncV2Response>; /** * Render a lipsync v2 video * @param id ID of the lipsync v2 task * @returns Promise resolving to the lipsync v2 task response * @see https://creatify.mintlify.app/api-reference/lipsyncs_v2/post-apilipsyncs-render */ renderLipsyncV2(id: string): Promise<LipsyncV2.LipsyncV2Response>; /** * Create a lipsync v2 video and wait for it to complete * @param params Parameters for the lipsync v2 video generation * @param pollInterval How often to check status in ms (default 2000) * @param maxAttempts Maximum number of polling attempts (default 30) * @returns Promise resolving to the completed lipsync v2 task */ createAndWaitForLipsyncV2(params: LipsyncV2.LipsyncV2Params, pollInterval?: number, maxAttempts?: number): Promise<LipsyncV2.LipsyncV2ResultResponse>; } export { AiEditingApi, AiScriptsApi, AiShortsApi, AvatarApi, CustomTemplatesApi, DyoaApi, LipsyncV2Api, MusicsApi, TextToSpeechApi, UrlToVideoApi, WorkspaceApi };