@vepler/area-reference-types
Version:
TypeScript type definitions for Vepler Area Reference API
133 lines (132 loc) • 2.29 kB
TypeScript
/**
* Ingest Metric API Types
*
* /api/metrics/ingest endpoint
*/
/**
* Metric data for ingestion
*/
export interface MetricIngestData {
/**
* Metric identifier (numeric ID)
*/
metricId: number;
/**
* Geographic entity ID (will be converted to number internally)
*/
geographicEntityId: string;
/**
* Metric value
*/
value: number;
/**
* Data date (ISO string, optional)
*/
date?: string;
/**
* Source service name (optional)
*/
sourceService?: string;
}
/**
* Ingestion processing options
*/
export interface IngestionOptions {
/**
* Skip validation of entity codes
*/
skipValidation?: boolean;
/**
* Overwrite existing values
*/
overwrite?: boolean;
/**
* Process asynchronously
*/
async?: boolean;
}
/**
* Ingest metric request body
*/
export interface IngestMetricRequest {
/**
* Array of metric data to ingest
*/
metrics: MetricIngestData[];
}
/**
* Ingestion error details
*/
export interface IngestionError {
/**
* Row index with error
*/
index: number;
/**
* Error message
*/
message: string;
/**
* Field that caused the error
*/
field?: string;
}
/**
* Ingestion result summary
*/
export interface IngestionResult {
/**
* Number of metrics successfully ingested
*/
ingested: number;
/**
* Number of metrics that failed validation
*/
failed: number;
/**
* Number of metrics skipped (duplicates)
*/
skipped: number;
/**
* Job identifier for async processing
*/
jobId?: string;
/**
* Validation errors
*/
errors?: IngestionError[];
}
/**
* Ingestion metadata
*/
export interface IngestionMetadata {
/**
* Batch identifier
*/
batchId: string;
/**
* Processing timestamp
*/
processedAt: string;
/**
* Data source
*/
source: string;
}
/**
* Ingest metric response
*/
export interface IngestMetricResponse {
/**
* Success flag
*/
success: boolean;
/**
* Ingestion result
*/
result: IngestionResult;
/**
* Processing metadata
*/
meta?: IngestionMetadata;
}