@vepler/area-reference-types
Version:
TypeScript type definitions for Vepler Area Reference API
192 lines (191 loc) • 4.15 kB
TypeScript
/**
* Common types shared across Connectivity API endpoints
*/
import { GeographicEntityType } from '../../common';
/**
* Fixed broadband breakdown structure
*/
export interface FixedBroadbandBreakdown {
[]: any;
}
/**
* Mobile coverage breakdown structure
*/
export interface MobileBreakdown {
[]: any;
}
/**
* Connectivity metric type
*/
export type ConnectivityMetricType = 'fixed_broadband' | 'mobile';
/**
* Connectivity breakdown aggregation level
*/
export type ConnectivityBreakdownLevel = 'raw' | 'aggregated';
/**
* Connectivity score result with individual metric scores
*/
export interface ConnectivityScoreResult {
/**
* Overall connectivity score (0.0-1.0)
*/
overall: number | null;
/**
* Fixed broadband connectivity score (0.0-1.0)
*/
fixedBroadband: number | null;
/**
* Mobile coverage connectivity score (0.0-1.0)
*/
mobileCoverage: number | null;
}
/**
* Speed coverage summary for fixed broadband
*/
export interface SpeedSummary {
/**
* Whether gigabit speeds are available in this area
*/
gigabitAvailable: boolean;
/**
* Percentage of premises with gigabit coverage
*/
gigabitCoverage: number | null;
/**
* Percentage of premises with ultrafast coverage (100+ Mbps)
*/
ultrafastCoverage: number | null;
/**
* Percentage of premises with superfast coverage (30+ Mbps)
*/
superfastCoverage: number | null;
/**
* Percentage of premises with poor coverage (<10 Mbps)
*/
poorCoveragePercentage: number | null;
}
/**
* Area information in connectivity responses
*/
export interface ConnectivityAreaInfo {
/**
* Geographic entity code
*/
code: string;
/**
* Human-readable area name
*/
name: string;
/**
* Geographic entity type
*/
type: string;
}
/**
* Data source information for connectivity metrics
*/
export interface ConnectivityDataSources {
/**
* Fixed broadband data source
*/
fixed?: {
/**
* Data collection method
*/
method: string;
/**
* Source area code used for data
*/
sourceCode: string;
};
/**
* Mobile coverage data source
*/
mobile?: {
/**
* Data collection method
*/
method: string;
/**
* Source area code used for data
*/
sourceCode: string;
};
}
/**
* Connectivity timeseries data point
*/
export interface ConnectivityTimeseriesData {
/**
* Data period (ISO date string)
*/
dataPeriod: string;
/**
* Connectivity scores for this period
*/
connectivityScores: ConnectivityScoreResult;
/**
* Speed coverage summary (if available)
*/
speedSummary?: SpeedSummary;
/**
* Detailed breakdown by metric type (if requested)
*/
breakdown?: {
/**
* Fixed broadband detailed breakdown
*/
fixedBroadband?: FixedBroadbandBreakdown;
/**
* Mobile coverage detailed breakdown
*/
mobileCoverage?: MobileBreakdown;
};
/**
* Data metadata for this period
*/
metadata: {
/**
* Original data vintage (ISO date string)
*/
dataVintage: string | null;
/**
* When scores were computed (ISO datetime string)
*/
computedAt: string;
};
}
/**
* Connectivity error response
*/
export interface ConnectivityErrorResponse {
/**
* Success flag
*/
success: false;
/**
* Error message
*/
error: string;
/**
* HTTP status code
*/
statusCode: number;
/**
* Additional error details
*/
details?: {
/**
* Invalid codes that were requested
*/
invalidCodes?: string[];
/**
* Unsupported geography types
*/
unsupportedTypes?: GeographicEntityType[];
/**
* Missing data periods
*/
missingPeriods?: string[];
};
}