@felixgeelhaar/govee-api-client
Version:
Enterprise-grade TypeScript client library for the Govee Developer REST API
75 lines • 2.6 kB
TypeScript
import { Logger } from 'pino';
import { IGoveeDeviceRepository } from '../../domain/repositories/IGoveeDeviceRepository';
import { GoveeDevice } from '../../domain/entities/GoveeDevice';
import { DeviceState } from '../../domain/entities/DeviceState';
import { Command } from '../../domain/entities/Command';
import { RetryExecutor, RetryResult } from './RetryableRequest';
/**
* Configuration for RetryableRepository
*/
export interface RetryableRepositoryConfig {
/** The underlying repository to wrap */
repository: IGoveeDeviceRepository;
/** Retry executor to use */
retryExecutor?: RetryExecutor;
/** Logger for retry operations */
logger?: Logger;
/** Enable request ID generation */
enableRequestIds?: boolean;
}
/**
* Repository wrapper that adds retry functionality to any IGoveeDeviceRepository implementation
*/
export declare class RetryableRepository implements IGoveeDeviceRepository {
private readonly repository;
private readonly retryExecutor;
private readonly logger?;
private readonly enableRequestIds;
private requestIdCounter;
constructor(config: RetryableRepositoryConfig);
/**
* Generates a unique request ID
*/
private generateRequestId;
/**
* Finds all devices with retry logic
*/
findAll(): Promise<GoveeDevice[]>;
/**
* Finds device state with retry logic
*/
findState(deviceId: string, sku: string): Promise<DeviceState>;
/**
* Sends command with retry logic
*/
sendCommand(deviceId: string, sku: string, command: Command): Promise<void>;
/**
* Gets detailed retry result for findAll operation
*/
findAllWithRetryResult(): Promise<RetryResult<GoveeDevice[]>>;
/**
* Gets detailed retry result for findState operation
*/
findStateWithRetryResult(deviceId: string, sku: string): Promise<RetryResult<DeviceState>>;
/**
* Gets detailed retry result for sendCommand operation
*/
sendCommandWithRetryResult(deviceId: string, sku: string, command: Command): Promise<RetryResult<void>>;
/**
* Gets current retry metrics
*/
getRetryMetrics(): Readonly<import("./RetryPolicy").RetryMetrics>;
/**
* Resets retry metrics
*/
resetRetryMetrics(): void;
/**
* Gets the underlying repository (for direct access when needed)
*/
getUnderlyingRepository(): IGoveeDeviceRepository;
}
/**
* Import the RetryResult type for convenience
*/
export { RetryResult, RetryAttempt } from './RetryableRequest';
//# sourceMappingURL=RetryableRepository.d.ts.map