UNPKG

brickcharts

Version:

A comprehensive library for managing Billboard and Last.FM charts with visualizations and data management

141 lines 3.39 kB
export interface ChartEntry { rank: number; title: string; artist: string; album?: string; label?: string; lastWeek?: number; peakPosition?: number; weeksOnChart?: number; chartDate: Date; source: ChartSource; metadata?: Record<string, any>; } export interface ChartData { chartType: string; date: Date; entries: ChartEntry[]; source: ChartSource; totalEntries: number; metadata?: Record<string, any>; } export interface HistoricalChartData { chartType: string; dateRange: DateRange; data: ChartData[]; source: ChartSource; } export declare enum ChartSource { BILLBOARD = "billboard", LASTFM = "lastfm", CUSTOM = "custom" } export interface BillboardChartType { name: string; id: string; category: 'songs' | 'albums' | 'artists'; } export interface BillboardEntry { rank: number; title: string; artist: string; weeks: number; lastWeek: number; peakPosition: number; chartDate: string; } export interface BillboardChart { chart: string; date: string; songs?: BillboardEntry[]; albums?: BillboardEntry[]; } export interface LastFMTrack { name: string; artist: { name: string; mbid?: string; }; playcount: string; listeners: string; rank: string; '@attr'?: { rank: string; }; } export interface LastFMChart { track?: LastFMTrack[]; '@attr': { from: string; to: string; page: string; perPage: string; total: string; totalPages: string; }; } export interface CacheOptions { ttl: number; maxSize: number; persistent: boolean; } export interface FetchOptions { date?: Date; limit?: number; offset?: number; useCache?: boolean; forceRefresh?: boolean; } export interface DateRange { start: Date; end: Date; } export interface ChartClient { name: string; source: ChartSource; getChart(type: string, options?: FetchOptions): Promise<ChartData>; getAvailableCharts(): Promise<string[]>; getHistoricalData(type: string, dateRange: DateRange): Promise<HistoricalChartData>; } export interface TrendData { entry: ChartEntry; trend: 'up' | 'down' | 'stable' | 'new'; positionChange: number; weeklyData: Array<{ date: Date; position: number; }>; } export interface ChartAnalytics { totalEntries: number; newEntries: number; droppedEntries: number; trends: TrendData[]; topMovers: { climbers: TrendData[]; fallers: TrendData[]; }; } export interface ChartVisualizationConfig { type: 'line' | 'bar' | 'bubble' | 'heatmap' | 'timeline'; width?: number; height?: number; responsive?: boolean; theme?: 'light' | 'dark' | 'custom'; colors?: string[]; animations?: boolean; interactive?: boolean; } export declare class BrickChartsError extends Error { code: string; source?: ChartSource | undefined; constructor(message: string, code: string, source?: ChartSource | undefined); } export declare class APIError extends BrickChartsError { statusCode: number; constructor(message: string, statusCode: number, source: ChartSource); } export declare class CacheError extends BrickChartsError { constructor(message: string); } //# sourceMappingURL=index.d.ts.map