@bobmatnyc/ai-code-review
Version:
A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter
25 lines (24 loc) • 978 B
TypeScript
/**
* @fileoverview HTTP client utilities for API interactions.
*
* This module provides common HTTP request handling functionality with retry logic,
* error handling, and timeout management. It's designed to be used by the various
* AI API client implementations.
*/
/**
* Fetch with automatic retry for transient errors
* @param url The URL to fetch from
* @param options Request options
* @param retries Number of retries to attempt
* @returns Promise resolving to the Response object
* @throws Error if all retries fail
*/
export declare function fetchWithRetry(url: string, options: RequestInit, retries?: number): Promise<Response>;
/**
* Generic retry mechanism for any asynchronous function
* @param fn The function to retry
* @param retries Maximum number of retries
* @returns Promise resolving to the function's result
* @throws Error if all retries fail
*/
export declare function withRetry<T>(fn: () => Promise<T>, retries?: number): Promise<T>;