UNPKG

stability-ai

Version:
42 lines (41 loc) 1.5 kB
export declare enum APIVersion { V1 = "v1", V2_BETA = "v2beta" } export type OutputFormat = 'jpeg' | 'png' | 'webp'; export declare const DEFAULT_OUTPUT_FORMAT: OutputFormat; export type StabilityAIContentResponse = { filepath: string; filename: string; contentType: 'image' | 'video' | '3d'; outputFormat: OutputFormat | 'mp4' | 'glb'; contentFiltered: boolean; errored: boolean; seed: number; }; export type StabilityAIStatusResult = { id: string; status: 'in-progress'; }; export declare function makeUrl(verison: APIVersion, resource: string, endpoint: string): string; export declare function isValidHttpUrl(value: string): boolean; export declare function isValidFile(value: string): boolean; export declare class ImagePath { private resource; private downloadFilepath?; private type; constructor(resource: string); filepath(): Promise<string>; cleanup(): void; } /** * Download an image from a URL and return the local file path * * @param url * @returns filepath string * * TODO - image type validation and use corresponding image filetype in filename */ export declare function downloadImage(url: string): Promise<string>; export declare function processArrayBufferResponse(data: any, outputFormat: 'glb', resource: string): Promise<StabilityAIContentResponse>; export declare function processContentResponse(data: any, outputFormat: OutputFormat | 'mp4', resource: string): Promise<StabilityAIContentResponse>;