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
44 lines • 1.8 kB
TypeScript
/**
* Session Proxy service for managing proxy assignments to sessions
*/
import { HttpClient } from '../../utils/http.utils';
import { AutomationWebResponse } from '../../types/common.types';
import { AssignProxyToSessionRequest, AssignProxyToSessionResponse } from '../../types/dto/session-proxy.type';
/**
* Session Proxy service class
*/
export declare class SessionProxyService {
private httpClient;
constructor(httpClient: HttpClient);
/**
* Assign proxy cho session và kích hoạt lại instance với proxy mới
*
* Flow:
* 1. Kiểm tra session và proxy tồn tại
* 2. Cập nhật proxy cho session trong database
* 3. Dừng listener cũ (nếu đang chạy)
* 4. Xóa instance cũ khỏi instance manager
* 5. Tạo instance mới với proxy được chỉ định
* 6. Khởi động listener mới với proxy
*
* @param request - Session ID và Proxy ID
* @returns Response với thông tin assign proxy
* @throws Error nếu session chưa đăng nhập hoặc proxy không khả dụng
*
* @example
* ```typescript
* const result = await sessionProxyService.assignProxyToSession({
* sessionId: 'session-175ae5b3-7c5c-4ee4-991f-67dc63156736',
* proxyId: 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
* });
*
* if (result.code === 200 && result.result?.success) {
* console.log('Proxy đã được gắn thành công:', result.result.message);
* } else {
* console.error('Gắn proxy thất bại:', result.error || result.message);
* }
* ```
*/
assignProxyToSession(request: AssignProxyToSessionRequest): Promise<AutomationWebResponse<AssignProxyToSessionResponse>>;
}
//# sourceMappingURL=session-proxy.service.d.ts.map