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.0: Added SessionProxyService for managing proxy assignments to sessions with
111 lines • 2.96 kB
TypeScript
/**
* HTTP utility functions for making API requests
*/
import { AutomationWebConfig, RequestOptions } from '../types/common.types';
/**
* Custom error class for HTTP requests
*/
export declare class HttpError extends Error {
status?: number;
code?: string;
response?: any;
constructor(message: string, status?: number, code?: string, response?: any);
}
/**
* HTTP client class for making requests to automation-web API
*/
export declare class HttpClient {
private axiosInstance;
private config;
constructor(config: AutomationWebConfig);
/**
* Create axios instance with default configuration
*/
private createAxiosInstance;
/**
* Handle axios errors and convert to HttpError
*/
private handleError;
/**
* Make HTTP request with retry logic
*/
private makeRequestWithRetry;
/**
* Determine if request should be retried
*/
private shouldRetry;
/**
* Delay utility for retry logic
*/
private delay;
/**
* Generic request method
*/
request<T = any>(options: RequestOptions): Promise<T>;
/**
* GET request
*/
get<T = any>(url: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
/**
* POST request
*/
post<T = any>(url: string, data?: any, headers?: Record<string, string>): Promise<T>;
/**
* PUT request
*/
put<T = any>(url: string, data?: any, headers?: Record<string, string>): Promise<T>;
/**
* DELETE request
*/
delete<T = any>(url: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
/**
* PATCH request
*/
patch<T = any>(url: string, data?: any, headers?: Record<string, string>): Promise<T>;
/**
* Update configuration
*/
updateConfig(newConfig: Partial<AutomationWebConfig>): void;
/**
* Get current configuration
*/
getConfig(): AutomationWebConfig;
}
/**
* Utility functions for HTTP operations
*/
export declare class HttpUtils {
/**
* Build query string from parameters
*/
static buildQueryString(params: Record<string, any>): string;
/**
* Parse response headers
*/
static parseHeaders(headers: Record<string, string>): Record<string, string>;
/**
* Check if URL is absolute
*/
static isAbsoluteUrl(url: string): boolean;
/**
* Join URL paths
*/
static joinPaths(...paths: string[]): string;
/**
* Validate URL format
*/
static isValidUrl(url: string): boolean;
/**
* Extract domain from URL
*/
static extractDomain(url: string): string | null;
/**
* Format file size in human readable format
*/
static formatFileSize(bytes: number): string;
/**
* Get MIME type from file extension
*/
static getMimeType(filename: string): string;
}
//# sourceMappingURL=http.utils.d.ts.map