/** * API Response Types * * Types for Caliper API responses. * * @remarks * **IMPORTANT - API Docs Drift**: The official API documentation (caliper/response.yaml * and caliper-api.yaml) does NOT accurately reflect actual API responses. The types * in this file were derived from testing actual API responses. See individual type * comments for specific discrepancies. */ import type { JobStatus, StoredEvent } from './events'; /** * Generic API response wrapper. */ export interface ApiResponse { status: 'success' | 'error'; message?: string; data?: T; } /** * Pagination metadata returned by list endpoints. */ export interface PaginationMeta { /** Total number of items across all pages */ total: number; /** Total number of pages */ totalPages: number; /** Current page number (1-indexed) */ currentPage: number; /** Number of items per page */ limit: number; } /** * Response from GET /caliper/events (list events). * * @remarks * **API Docs Drift**: Official docs (caliper/response.yaml) incorrectly show * `{ status, message, errors? }`. Actual response is `{ events, pagination }`. */ export interface ListEventsResponse { /** Array of stored events */ events: StoredEvent[]; /** Pagination metadata */ pagination: PaginationMeta; } /** * Response from GET /caliper/events/:externalId (get single event). * * @remarks * **API Docs Drift**: Official docs (caliper/response.yaml) incorrectly show * `{ status, message, errors? }`. Actual response is `{ status, event }`. */ export interface GetEventResponse { /** Status indicator */ status: 'success' | 'error'; /** The requested event */ event: StoredEvent; } /** * Response from POST /caliper/event (send events). * * @remarks * **API Docs Drift**: Official docs (caliper/response.yaml) incorrectly show * `{ status, message, errors? }`. Actual response is `{ jobId }`. * Use the jobId with `jobs.getStatus()` to track processing. */ export interface SendEventsResponse { /** Job ID for tracking async processing */ jobId: string; } /** * Job status response payload (GET /jobs/{jobId}/status). * * @remarks * This endpoint is correctly documented in caliper/response.yaml. */ export interface JobStatusResponse { job: JobStatus; } /** * Options for waitForCompletion polling. */ export interface WaitForCompletionOptions { /** Maximum time to wait in milliseconds (default: 30000) */ timeoutMs?: number; /** Interval between status checks in milliseconds (default: 1000) */ pollIntervalMs?: number; } /** * Validation result from the validate endpoint. */ export interface ValidationResult { /** Whether validation succeeded */ status: 'success' | 'error'; /** Human-readable message */ message?: string; /** Validation errors (if any) */ errors?: unknown; } //# sourceMappingURL=api.d.ts.map