/** * Types for Amplitude API */ /** * Amplitude API credentials */ export interface AmplitudeCredentials { apiKey: string; secretKey: string; } /** * Base parameters for all Amplitude API requests */ export interface BaseAmplitudeParams { start: string; end: string; } /** * Event Segmentation API request parameters */ export interface EventSegmentationParams extends BaseAmplitudeParams { events: EventSegmentationEvent[]; interval?: string; groupBy?: string; filters?: EventSegmentationFilter[]; breakdowns?: EventSegmentationBreakdown[]; } /** * Event definition for segmentation */ export interface EventSegmentationEvent { eventType: string; propertyFilters?: PropertyFilter[]; } /** * Filter for event segmentation */ export interface EventSegmentationFilter { type: 'property' | 'event' | 'user'; propertyName?: string; value?: string | number | boolean | Array; op?: 'is' | 'is not' | 'contains' | 'does not contain' | '>' | '<' | '>=' | '<='; } /** * Breakdown for event segmentation */ export interface EventSegmentationBreakdown { type: 'event' | 'user'; propertyName: string; } /** * Property filter */ export interface PropertyFilter { propertyName: string; value: string | number | boolean | Array; op: 'is' | 'is not' | 'contains' | 'does not contain' | '>' | '<' | '>=' | '<='; } /** * Event Segmentation API response */ export interface EventSegmentationResponse { data: { series: Array<{ eventType: string; data: Array; }>; seriesLabels: Array; xValues: Array; }; metadata: { start: string; end: string; interval: string; }; } /** * Error response from Amplitude API */ export interface AmplitudeErrorResponse { error: string; code?: number; message?: string; } /** * Export API request parameters */ export interface ExportParams { start: string; end: string; } /** * Export API event data structure */ export interface ExportedEvent { server_received_time?: string; app?: number; device_carrier?: string; city?: string; user_id?: string; uuid?: string; event_time?: string; platform?: string; os_version?: string; amplitude_id?: number; processed_time?: string; version_name?: string; ip_address?: string; paying?: boolean; dma?: string; group_properties?: Record; user_properties?: Record; client_upload_time?: string; $insert_id?: string; event_type?: string; library?: string; amplitude_attribution_ids?: string; device_type?: string; start_version?: string; location_lng?: number; location_lat?: number; server_upload_time?: string; event_id?: number; os_name?: string; groups?: Record; event_properties?: Record; data?: Record; device_id?: string; language?: string; country?: string; region?: string; session_id?: number; device_family?: string; sample_rate?: any; client_event_time?: string; } /** * Dashboard API - Common Parameters */ export interface DashboardBaseParams { start: string; end: string; } /** * Dashboard API - User Activity Parameters */ export interface UserActivityParams { user: string; offset?: number; limit?: number; direction?: 'earliest' | 'latest'; } /** * Dashboard API - Event Segmentation Parameters */ export interface EventSegmentationDashboardParams extends DashboardBaseParams { e: string; m?: string; i?: number; s?: string; g?: string; limit?: number; } /** * Dashboard API - Funnel Analysis Parameters */ export interface FunnelAnalysisParams extends DashboardBaseParams { events: string[]; mode?: 'ordered' | 'unordered' | 'sequential'; i?: number; s?: string; g?: string; cs?: number; limit?: number; } /** * Dashboard API - Retention Analysis Parameters */ export interface RetentionAnalysisParams extends DashboardBaseParams { se: string; re: string; rm?: 'bracket' | 'rolling' | 'n-day'; rb?: string; i?: number; s?: string; g?: string; } /** * Chart Annotations API - Create Annotation Parameters */ export interface CreateAnnotationParams { app_id: number; date: string; label: string; chart_id?: string; details?: string; } /** * Chart Annotations API - Annotation Response */ export interface AnnotationResponse { id: number; date: string; label: string; details?: string; }