UNPKG

redai-automation-web-sdk

Version:

TypeScript SDK for RedAI Automation Web API - Zalo Personal automation, messaging, advanced sticker search, and bulk operations. 100% compatible with automation-web backend. v1.8.1: Updated GroupInfo interface to match backend controller with complete gro

301 lines 5.48 kB
/** * Common types and interfaces used across the SDK */ /** * Base response interface from automation-web API */ export interface AutomationWebResponse<T = any> { /** * Result data from the API */ result?: T; /** * HTTP status code */ code?: number; /** * Response message */ message?: string; /** * Error message (if any) */ error?: string; } /** * SDK Configuration interface */ export interface AutomationWebConfig { /** * Base URL of the automation-web API * @default 'http://localhost:3000' */ baseUrl: string; /** * Request timeout in milliseconds * @default 30000 */ timeout?: number; /** * Number of retry attempts for failed requests * @default 3 */ retryCount?: number; /** * Delay between retry attempts in milliseconds * @default 1000 */ retryDelay?: number; /** * API key for authentication (if required) */ apiKey?: string; /** * Custom user agent string */ userAgent?: string; /** * Enable debug logging * @default false */ logging?: boolean; } /** * Default SDK configuration */ export declare const DEFAULT_CONFIG: Required<Omit<AutomationWebConfig, 'apiKey'>>; /** * Thread type enum for messaging */ export declare enum ThreadType { USER = "user", GROUP = "group" } /** * Message urgency levels */ export declare enum Urgency { LOW = 1, NORMAL = 2, HIGH = 3 } /** * Text style types for message formatting */ export declare enum TextStyle { BOLD = "font-weight:bold", ITALIC = "font-style:italic", UNDERLINE = "text-decoration:underline", STRIKETHROUGH = "text-decoration:line-through" } /** * Zalo reactions enum */ export declare enum ZaloReactions { LIKE = "/-heart", LOVE = "/-heart", HAHA = ":))", WOW = ":-o", SAD = ":(", ANGRY = ">-|", HANDCLAP = ":handclap" } /** * Style object for message text formatting */ export interface StyleDto { /** * Start position of the style */ start: number; /** * Length of the styled text */ len: number; /** * Style type */ st: string; } /** * Mention object for tagging users in messages */ export interface MentionDto { /** * User ID to mention */ uid: string; /** * Start position of the mention */ start: number; /** * Length of the mention text */ len: number; } /** * Quote object for replying to messages */ export interface SendMessageQuoteDto { /** * ID of the message being quoted */ msgId: string; /** * Content of the quoted message */ content: string; /** * Author of the quoted message */ author: string; } /** * Attachment metadata */ export interface AttachmentDto { /** * URL of the attachment */ url: string; /** * File name */ fileName?: string; /** * File size in bytes */ fileSize?: number; /** * MIME type */ mimeType?: string; /** * Duration for audio/video files */ duration?: number; /** * Thumbnail URL for images/videos */ thumbnail?: string; } /** * Pagination parameters */ export interface PaginationParams { /** * Page number (1-based) */ page?: number; /** * Number of items per page */ limit?: number; /** * Sort field */ sortBy?: string; /** * Sort order */ sortOrder?: 'asc' | 'desc'; } /** * Paginated response */ export interface PaginatedResponse<T> { /** * Array of items */ items: T[]; /** * Total number of items */ total: number; /** * Current page number */ page: number; /** * Number of items per page */ limit: number; /** * Total number of pages */ totalPages: number; /** * Whether there are more pages */ hasNext: boolean; /** * Whether there are previous pages */ hasPrev: boolean; } /** * Operation result for batch operations */ export interface OperationResult { /** * Whether the operation was successful */ success: boolean; /** * Error message if operation failed */ error?: string; /** * Additional data */ data?: any; } /** * Batch operation result */ export interface BatchOperationResult { /** * Total number of operations attempted */ total: number; /** * Number of successful operations */ successful: number; /** * Number of failed operations */ failed: number; /** * Individual operation results */ results: OperationResult[]; /** * Summary of the batch operation */ summary: { successRate: number; errors: string[]; }; } /** * Event handler function type */ export type EventHandler<T = any> = (data: T) => Promise<void> | void; /** * HTTP method types */ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; /** * Request options for HTTP client */ export interface RequestOptions { method: HttpMethod; url: string; data?: any; params?: Record<string, any>; headers?: Record<string, string>; timeout?: number; } //# sourceMappingURL=common.types.d.ts.map