UNPKG

autotrader-connect-api

Version:

Production-ready TypeScript wrapper for Auto Trader UK Connect APIs

169 lines 3.12 kB
/** * Common types used across the AutoTrader API */ /** * Standard API response wrapper */ export interface ApiResponse<T> { data: T; success: boolean; message?: string; errors?: ApiError[]; } /** * API error structure */ export interface ApiError { code: string; message: string; field?: string; details?: Record<string, unknown>; } /** * Pagination information */ export interface Pagination { page: number; pageSize: number; totalItems: number; totalPages: number; hasNext: boolean; hasPrevious: boolean; } /** * Paginated response wrapper */ export interface PaginatedResponse<T> { data: T[]; pagination: Pagination; success: boolean; message?: string; } /** * Sort options */ export interface SortOptions { field: string; direction: 'asc' | 'desc'; } /** * Date range filter */ export interface DateRange { from?: string; to?: string; } /** * Price range filter */ export interface PriceRange { min?: number; max?: number; } /** * Numeric range filter */ export interface NumericRange { min?: number; max?: number; } /** * Geographic location */ export interface Location { latitude?: number; longitude?: number; postcode?: string; address?: string; city?: string; county?: string; country?: string; } /** * Contact information */ export interface ContactInfo { phone?: string; email?: string; website?: string; fax?: string; } /** * Image metadata */ export interface ImageInfo { id: string; url: string; thumbnailUrl?: string; caption?: string; order: number; width?: number; height?: number; size?: number; } /** * HTTP methods */ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; /** * API client configuration */ export interface ApiClientConfig { baseURL: string; apiKey: string; apiSecret: string; timeout?: number; maxRetries?: number; rateLimitRequests?: number; rateLimitWindow?: number; debug?: boolean; /** Use sandbox API for testing */ useSandbox?: boolean; } /** * Sandbox-specific configuration options */ export interface SandboxConfig { /** Sandbox API key */ sandboxApiKey: string; /** Sandbox API secret */ sandboxApiSecret: string; /** Sandbox base URL */ sandboxBaseURL: string; /** Force sandbox mode regardless of NODE_ENV */ forceSandbox?: boolean; } /** * Request options */ export interface RequestOptions { params?: Record<string, unknown>; headers?: Record<string, string>; timeout?: number; } /** * Rate limiting configuration */ export interface RateLimitConfig { requests: number; window: number; burst?: number; } /** * Authentication token response */ export interface TokenResponse { access_token: string; token_type: 'Bearer'; expires_in: number; scope?: string; } /** * Cached token information */ export interface CachedToken { token: string; expiresAt: number; issuedAt: number; } //# sourceMappingURL=common.d.ts.map