@lineai/municipal-intel
Version:
AI-first municipal data API providing natural language descriptions of building permits and planning applications from major US cities
88 lines (87 loc) • 2.52 kB
TypeScript
/**
* Base client interface for municipal data sources
*/
import { MunicipalProject, MunicipalSearchResponse } from '../types/projects';
import { MunicipalSource } from '../types/sources';
/**
* Base configuration for all clients
*/
export interface BaseClientConfig {
source: MunicipalSource;
timeout?: number;
retries?: number;
debug?: boolean;
}
/**
* Health check result
*/
export interface HealthCheck {
status: 'healthy' | 'degraded' | 'unhealthy';
latency?: number;
error?: string;
lastChecked: Date;
}
/**
* Abstract base class for municipal data clients
*/
export declare abstract class BaseMunicipalClient {
protected source: MunicipalSource;
protected timeout: number;
protected retries: number;
protected debug: boolean;
constructor(config: BaseClientConfig);
/**
* Get the source configuration
*/
getSource(): MunicipalSource;
/**
* Search for municipal projects
*/
abstract search(): Promise<MunicipalSearchResponse>;
/**
* Get a specific project by ID
*/
abstract getProject(id: string): Promise<MunicipalProject | null>;
/**
* Get a project by its URL
*/
abstract getByUrl(url: string): Promise<MunicipalProject | null>;
/**
* Check if the data source is healthy
*/
abstract healthCheck(): Promise<HealthCheck>;
/**
* Get available project types for this source
*/
abstract getAvailableTypes(): Promise<string[]>;
/**
* Log debug message if debug mode enabled
*/
protected log(message: string, data?: any): void;
/**
* Sleep for specified milliseconds
*/
protected sleep(ms: number): Promise<void>;
/**
* Retry a function with exponential backoff
*/
protected withRetry<T>(fn: () => Promise<T>, retries?: number, delay?: number): Promise<T>;
}
/**
* Error types for municipal data access
*/
export declare class MunicipalDataError extends Error {
source: string;
statusCode?: number | undefined;
details?: any;
constructor(message: string, source: string, statusCode?: number | undefined, details?: any);
}
export declare class AuthenticationError extends MunicipalDataError {
constructor(source: string, details?: any);
}
export declare class RateLimitError extends MunicipalDataError {
constructor(source: string, resetTime?: Date);
}
export declare class ServiceUnavailableError extends MunicipalDataError {
constructor(source: string, details?: any);
}