@vepler/area-reference-types
Version:
TypeScript type definitions for Vepler Area Reference API
148 lines (147 loc) • 2.53 kB
TypeScript
/**
* Common types shared across POI API endpoints
*/
/**
* Geographic coordinates
*/
export interface Coordinates {
/**
* Latitude
*/
latitude: number;
/**
* Longitude
*/
longitude: number;
}
/**
* GeoJSON Point geometry
*/
export interface GeoJSONPoint {
type: 'Point';
coordinates: [number, number];
}
/**
* POI feature properties
*/
export interface POIProperties {
/**
* POI unique identifier
*/
id: string;
/**
* POI name
*/
name: string;
/**
* POI category identifier
*/
categoryId: string;
/**
* POI category name
*/
categoryName?: string;
/**
* Address information
*/
address?: string;
/**
* Postcode
*/
postcode?: string;
/**
* Additional metadata
*/
metadata?: Record<string, any>;
/**
* Last updated timestamp
*/
updatedAt?: string;
}
/**
* GeoJSON POI feature
*/
export interface POIFeature {
type: 'Feature';
geometry: GeoJSONPoint;
properties: POIProperties;
}
/**
* Routing information for a single transport mode
*/
export interface RouteInfo {
/**
* Distance in meters
*/
distance: number;
/**
* Duration in seconds
*/
duration: number;
/**
* Distance in kilometres (calculated)
*/
distanceKm: number;
/**
* Duration in minutes (calculated)
*/
durationMinutes: number;
}
/**
* Routing information for all transport modes
*/
export interface RoutingInfo {
/**
* Car routing information
*/
car: RouteInfo;
/**
* Bicycle routing information
*/
bike: RouteInfo;
/**
* Walking routing information
*/
foot: RouteInfo;
}
/**
* POI error response
*/
export interface POIErrorResponse {
/**
* Success flag
*/
success: false;
/**
* Error message
*/
error: string;
/**
* HTTP status code
*/
statusCode: number;
/**
* Additional error details
*/
details?: {
/**
* Invalid coordinates
*/
invalidCoordinates?: boolean;
/**
* Invalid bounding box
*/
invalidBounds?: boolean;
/**
* Unknown categories
*/
unknownCategories?: string[];
/**
* Parameter validation errors
*/
validationErrors?: Array<{
field: string;
message: string;
}>;
};
}