UNPKG

magically-sdk

Version:

Official SDK for Magically - Build mobile apps with AI

155 lines (154 loc) 3.24 kB
export interface User { id: string; email: string; name: string; firstName?: string; lastName?: string; } export interface AuthState { user: User | null; isAuthenticated: boolean; isLoading: boolean; error: string | null; } export interface TokenData { accessToken: string; refreshToken: string; expiresIn: number; tokenType: string; } export interface DataQueryOptions { sort?: Record<string, 1 | -1>; limit?: number; skip?: number; } export interface DataQueryResult<T> { data: T[]; total: number; } export interface DataInsertOptions<T = any> { data: T; upsert?: boolean; } export interface StandardFields { _id: string; creator: string; createdAt: Date; updatedAt: Date; isPublic?: boolean; } export interface LLMTextContent { type: 'text'; text: string; } export interface LLMImageContent { type: 'image'; image: string | URL; } export type LLMContent = LLMTextContent | LLMImageContent; export interface LLMMessage { role: 'system' | 'user' | 'assistant'; content: string | LLMContent[]; } export interface InvokeOptions { model?: string; temperature?: number; response_json_schema?: object; images?: string[]; } export interface ChatOptions { model?: string; temperature?: number; stream?: boolean; } export interface ImageOptions { model?: string; size?: '1024x1024' | '1792x1024' | '1024x1792'; quality?: 'standard' | 'hd'; n?: number; } export interface InvokeTextResponse { text: string; } export interface ChatResponse { message: { role: 'assistant'; content: string; }; usage: any; } export interface SingleImageResponse { url: string; filename: string; prompt: string; model: string; size: string; quality: string; downloadUrl: string; } export interface MultipleImageResponse { images: Array<{ url: string; filename: string; downloadUrl: string; }>; prompt: string; model: string; size: string; count: number; } export interface ModelsResponse { text: string[]; image: string[]; default: { text: string; image: string; }; } export interface FileUploadOptions { tags?: string[]; metadata?: Record<string, any>; } export interface FileListOptions { limit?: number; skip?: number; tags?: string[]; mimeType?: string; } export interface UploadedFile { _id: string; filename: string; originalName: string; mimeType: string; size: number; url: string; downloadUrl: string; pathname: string; creator: string; tags?: string[]; metadata?: Record<string, any>; createdAt: Date; updatedAt: Date; } export interface FileListResponse { success: boolean; data: UploadedFile[]; total: number; limit: number; skip: number; } export interface SDKConfig { projectId: string; apiUrl?: string; debug?: boolean; linkingScheme?: string; } export interface AuthCallbackMessage { type: 'magically-auth-callback'; accessToken: string; user: { id: string; email: string; name: string; }; }