@vepler/safety-types
Version:
TypeScript type definitions for Vepler Safety Service API
87 lines (86 loc) • 2.16 kB
TypeScript
/**
* Types for /api/crime/get-crime-data endpoint
*/
/**
* Query parameters for crime data requests
*/
export interface GetCrimeDataQueryParams {
/** Geographic codes to query (comma-separated) */
geographicCodes: string;
/** Time periods to query (comma-separated) */
periods?: string;
/** Start date for date range queries */
startDate?: string;
/** End date for date range queries */
endDate?: string;
/** Crime categories to filter (comma-separated) */
categories?: string;
/** Country code (default: 'uk') */
countryCode?: string;
}
/**
* Query parameters for local crime data
*/
export interface GetLocalCrimeDataQueryParams {
/** Longitude coordinate */
lng?: number;
/** Latitude coordinate */
lat?: number;
/** Search radius in meters */
radius?: number;
/** Target date in YYYY-MM format */
date?: string;
/** Postcode (alternative to coordinates) */
postcode?: string;
}
/**
* Crime data response format
*/
export interface GetCrimeDataResponse {
/** Crime ID */
id: string;
/** Crime category */
category: string;
/** Location description */
location: string;
/** Coordinates */
coordinates: [number, number];
/** Crime date */
date: string;
/** Outcome status */
outcome?: string;
}
/**
* Coordinates for geographic locations
*/
export interface Coordinates {
/** Latitude in decimal degrees */
latitude: number;
/** Longitude in decimal degrees */
longitude: number;
}
/**
* Crime statistics summary
*/
export interface CrimeStats {
/** Total number of crimes */
total: number;
/** Breakdown by crime type */
types: Record<string, number>;
}
/**
* Error response for crime data operations
*/
export interface CrimeErrorResponse {
/** Whether the operation was successful */
success: false;
/** Error message */
error: string;
/** Detailed validation errors if applicable */
details?: Array<{
/** Field that failed validation */
field: string;
/** Error message for this field */
message: string;
}>;
}