aura-glass
Version:
A comprehensive glassmorphism design system for React applications with 142+ production-ready components
206 lines • 5.33 kB
TypeScript
/**
* AuraGlass AI API Client
*
* Easy-to-use client for accessing production AI features from React components.
* Handles authentication, error handling, and request/response formatting.
*/
export interface AIClientConfig {
apiUrl?: string;
wsUrl?: string;
getAuthToken?: () => Promise<string | null>;
onError?: (error: Error) => void;
}
export interface FormFieldSuggestion {
fieldName: string;
fieldType: 'text' | 'email' | 'password' | 'number' | 'date' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'file';
label: string;
placeholder?: string;
required: boolean;
validation?: {
minLength?: number;
maxLength?: number;
pattern?: string;
customMessage?: string;
};
options?: Array<{
value: string;
label: string;
}>;
}
export interface SearchResult {
id: string;
content: string;
metadata: Record<string, any>;
score: number;
highlights?: string[];
}
export interface ImageAnalysis {
faces?: Array<{
boundingBox: {
left: number;
top: number;
width: number;
height: number;
};
confidence: number;
emotions: {
joy: number;
sorrow: number;
anger: number;
surprise: number;
};
}>;
objects?: Array<{
name: string;
confidence: number;
boundingBox: {
left: number;
top: number;
width: number;
height: number;
};
}>;
text?: {
text: string;
confidence: number;
blocks: Array<{
text: string;
confidence: number;
boundingBox: any;
}>;
};
labels?: Array<{
description: string;
score: number;
}>;
safeSearch?: {
adult: string;
violence: string;
medical: string;
};
colors?: Array<{
color: {
red: number;
green: number;
blue: number;
};
score: number;
pixelFraction: number;
}>;
}
declare class AIClient {
private config;
private authToken;
constructor(config?: AIClientConfig);
/**
* Set authentication token for API requests
*/
setAuthToken(token: string | null): void;
/**
* Make authenticated API request
*/
private request;
/**
* Login with email and password
*/
login(email: string, password: string): Promise<{
token: string;
refreshToken: string;
user: {
id: string;
email: string;
name?: string;
role: string;
permissions: string[];
};
}>;
/**
* Register new user
*/
register(email: string, password: string, name?: string): Promise<unknown>;
/**
* Refresh authentication token
*/
refreshToken(refreshToken: string): Promise<{
token: string;
}>;
/**
* Logout current user
*/
logout(): Promise<void>;
/**
* Generate smart form fields based on context
*
* @example
* const fields = await client.generateFormFields('user registration form');
*/
generateFormFields(context: string, existingFields?: FormFieldSuggestion[]): Promise<FormFieldSuggestion[]>;
/**
* Perform semantic search with AI-enhanced query
*
* @example
* const results = await client.search('how to add glassmorphism', { limit: 10 });
*/
search(query: string, options?: {
limit?: number;
semanticWeight?: number;
keywordWeight?: number;
}): Promise<{
results: SearchResult[];
enhancedQuery: string;
intent: string;
totalResults: number;
}>;
/**
* Index documents for semantic search
*
* @example
* await client.indexDocuments([
* { id: '1', content: 'Document content...', title: 'Doc 1' }
* ]);
*/
indexDocuments(documents: Array<{
id: string;
content: string;
title?: string;
metadata?: Record<string, any>;
tags?: string[];
}>): Promise<{
success: boolean;
indexed: number;
}>;
/**
* Analyze image with Google Vision API
*
* @example
* const analysis = await client.analyzeImage(base64Image, ['faces', 'objects']);
*/
analyzeImage(imageData: string, analysisTypes?: ('faces' | 'objects' | 'text' | 'labels' | 'all')[]): Promise<ImageAnalysis>;
/**
* Remove background from image
*
* @example
* const processedImage = await client.removeBackground(base64Image);
*/
removeBackground(imageData: string): Promise<string>;
/**
* Generate content summary
*
* @example
* const summary = await client.summarize(longText, 200);
*/
summarize(content: string, maxLength?: number): Promise<string>;
/**
* Check server health
*/
healthCheck(): Promise<{
status: string;
timestamp: string;
uptime: number;
services: Record<string, boolean>;
features: Record<string, boolean>;
}>;
}
export declare const aiClient: AIClient;
export default AIClient;
//# sourceMappingURL=ai-client.d.ts.map