UNPKG

imagic-sdk

Version:

Official Node.js SDK for Imagic image optimization API

64 lines 1.73 kB
export interface ImagicClientConfig { apiKey: string; baseUrl?: string; timeout?: number; } export interface UploadOptions { filename?: string; contentType?: string; } export interface UploadResponse { success: boolean; data?: { id: string; key: string; url: string; name: string; size: number; type: string; uploadedAt: string; }; message?: string; warning?: string; } export interface ErrorResponse { success: false; error: string; message: string; } export type ApiResponse = UploadResponse | ErrorResponse; export interface ApiInfo { name: string; version: string; description: string; endpoints: { upload: { path: string; method: string; description: string; documentation: string; }; }; authentication: { type: string; description: string; obtain_keys: string; }; } export declare const SUPPORTED_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/jpg", "image/bmp", "image/gif", "image/webp", "image/svg+xml"]; export type SupportedMimeType = typeof SUPPORTED_MIME_TYPES[number]; export declare class ImagicError extends Error { readonly statusCode?: number; readonly errorType?: string; constructor(message: string, statusCode?: number, errorType?: string); } export declare class ValidationError extends ImagicError { constructor(message: string); } export declare class AuthenticationError extends ImagicError { constructor(message: string); } export declare class NetworkError extends ImagicError { constructor(message: string); } //# sourceMappingURL=types.d.ts.map