@realitydefender/realitydefender
Version:
SDK for the Reality Defender API for deepfake detection
60 lines (59 loc) • 2.33 kB
TypeScript
/**
* Reality Defender SDK
* Client library for deepfake detection using the Reality Defender API
*/
import { TypedEventEmitter } from './core/events';
import { DetectionResult, GetResultOptions, RealityDefenderConfig, UploadOptions, UploadResult } from './types';
/**
* Main SDK class for interacting with the Reality Defender API
*/
export declare class RealityDefender extends TypedEventEmitter {
private readonly apiKey;
private readonly client;
/**
* Creates a new Reality Defender SDK instance
* @param config Configuration options
*/
constructor(config: RealityDefenderConfig);
/**
* Upload a file to Reality Defender for analysis
*
* @param options Upload options including file path
* @returns Promise with the request ID
*/
upload(options: UploadOptions): Promise<UploadResult>;
/**
* Get the detection result for a specific request ID
*
* @param requestId The request ID to get results for
* @param options Optional parameters for polling
* @returns Promise with the detection result
*/
getResult(requestId: string, options?: GetResultOptions): Promise<DetectionResult>;
/**
* Upload a file and get detection results in a single operation
*
* @param options Upload options including file path
* @param resultOptions Optional parameters for polling results
* @returns Promise with the detection result
*/
detect(options: UploadOptions, resultOptions?: GetResultOptions): Promise<DetectionResult>;
/**
* Start polling for results with event-based callback
*
* @param requestId The request ID to poll for
* @param options Polling configuration options
* @returns Promise that resolves when polling completes (for testing purposes)
*/
pollForResults(requestId: string, options?: {
pollingInterval?: number;
timeout?: number;
}): Promise<void>;
/**
* Internal implementation of polling for results
* @returns Promise that resolves when polling completes (for testing purposes)
*/
private _pollForResults;
}
export { RealityDefenderConfig, UploadOptions, UploadResult, DetectionResult, GetResultOptions, DetectionOptions, } from './types/sdk';
export { RealityDefenderError, ErrorCode } from './errors';