/** * FieldFunded Sports API — Official TypeScript SDK * * Zero-dependency client for all 25 API endpoints. * Works in Node.js 18+, Deno, Bun, and browsers. * * @example * ```typescript * import { FieldFundedSDK } from '@fieldfunded/sdk'; * * const client = new FieldFundedSDK({ apiKey: 'YOUR_API_KEY' }); * const events = await client.getEvents({ sport: 'soccer', status: 'live' }); * ``` */ import type { SDKConfig, EventFilters, BaseSportFilter, SportFilter, ScoreFilters, SearchOptions, SettlementFilters, OutrightSettlementFilters, EventOptions, FeaturedOptions, BetCheckRequest, ParlayCheckRequest, PingResponse, HealthResponse, StatusResponse, SportsResponse, EventsResponse, LiveResponse, FeaturedResponse, ScoresResponse, SearchResponse, LeaguesResponse, MarketsResponse, EventDetail, EventOddsResponse, BatchResponse, BetCheckResponse, ParlayResult, ParlayBatchResult, EventResult, SettlementsResponse, OutrightSettlementsResponse, UsageResponse, UsageEndpointsResponse, UsageWarningsResponse, OutrightsListResponse, OutrightSportsResponse, OutrightDetailResponse } from './types'; export * from './types'; export * from './errors'; export declare class FieldFundedSDK { private readonly apiKey; private readonly baseUrl; private readonly host; private readonly useRapidApi; private readonly timeout; private readonly retries; constructor(config: SDKConfig); private buildHeaders; private buildUrl; private request; private sleep; /** Latency check — returns immediately. Quota-free (fixed limit: 2 req/s, 120 req/h for all plans). */ ping(): Promise; /** System health — checks data freshness and service status. Quota-free (fixed limit: 2 req/s, 120 req/h for all plans). */ health(): Promise; /** API status with live/prematch counts. Quota-free (fixed limit: 2 req/s, 120 req/h for all plans). */ status(): Promise; /** Get current usage stats (quota consumption, daily breakdown) */ getUsage(): Promise; /** Get per-endpoint usage breakdown for the current month */ getUsageEndpoints(): Promise; /** Get active warnings (quota alerts, error rate warnings) */ getUsageWarnings(): Promise; /** List all available sports with event counts */ getSports(): Promise; /** List all active leagues with slugs, event counts, and live counts */ getLeagues(opts?: BaseSportFilter): Promise; /** List known market types grouped by sport */ getMarkets(opts?: SportFilter): Promise; /** * List events with full filtering support. * * @example * ```typescript * // All live football in England * const events = await client.getEvents({ * sport: 'soccer', * country: 'england', * status: 'live', * }); * * // Games starting in the next 2 hours * const upcoming = await client.getEvents({ starts_within: '2h' }); * ``` */ getEvents(opts?: EventFilters): Promise; /** Get all live events (convenience shortcut for getEvents({ status: 'live' })) */ getLive(opts?: SportFilter): Promise; /** Get featured games from priority leagues. Set `markets: true` for full market depth (1,000+ markets per event). */ getFeatured(opts?: FeaturedOptions): Promise; /** Get live scores — lightweight, optimized for frequent polling */ getScores(opts?: ScoreFilters): Promise; /** * Search events by team name or league name. * * @param query Search string (min 2 characters) * @example * ```typescript * const results = await client.search('Arsenal', { limit: 10 }); * ``` */ search(query: string, opts?: SearchOptions): Promise; /** Get full event detail including all markets, scoreboard, and sport-specific data */ getEvent(eventId: string, opts?: EventOptions): Promise; /** Get event odds only (lighter than full detail — returns only id, status, markets, updated_at) */ getEventOdds(eventId: string, opts?: EventOptions): Promise; /** * Get result for an ended event (score-only). * * @remarks * Available automatically as soon as the game finishes — no developer action required. * This endpoint returns **scores only**, not market-level resolutions. * For market outcomes (`won`/`lost`/`refund`), use {@link getSettlements}. * * @example * ```typescript * const result = await client.getEventResult(eventId); // Use an ID from getEvents() * if (result.status === 'ended') { * console.log(`Final: ${result.home_score} - ${result.away_score}`); * } * ``` */ getEventResult(eventId: string): Promise; /** * Fetch multiple events in a single request. * * @param eventIds Array of event IDs (max 20) * @example * ```typescript * const batch = await client.getEventsBatch(['123', '456', '789']); * ``` */ getEventsBatch(eventIds: string[], opts?: EventOptions): Promise; /** * Check a single bet — submit selections and get automatic resolution status. * * @remarks * Settlement is fully automatic — the API resolves your selections against * market outcomes that are computed server-side as soon as each game ends. * No manual intervention is needed. * * Optionally include `stake` (currency-agnostic — any numeric amount) to get * a calculated `payout` in the response: `payout = stake × payout_multiplier`. * * Include `market_id` and `selection_id` (primary identification method) from `/events` or `/settlements` * for guaranteed 100% accuracy. Market names are available as a secondary fallback for display only. * * `market_id` values are consistent across all fixtures within the same sport (e.g. `market_id: 36` = 1X2 in every soccer match). * * @example * ```typescript * const result = await client.checkBet({ * selections: [{ * event_id: '123', * market: 'Match Winner', * outcome: 'Home', * odds: 1.85, * stake: 10, * market_id: 340168, // primary — recommended for 100% accuracy * selection_id: 1824650, // primary — recommended for 100% accuracy * }], * }); * console.log(result.results[0].payout); // 18.50 (won) * ``` */ checkBet(request: BetCheckRequest): Promise; /** * Check a parlay / accumulator — submit multiple legs and get combined resolution. * * Include `market_id` and `selection_id` (primary identification method) on each leg for guaranteed accuracy. * * @example * ```typescript * const result = await client.checkParlay({ * legs: [ * { event_id: '123', market: 'Match Winner', outcome: 'Home', odds: 1.85, market_id: 340168, selection_id: 1824650 }, * { event_id: '456', market: 'Over/Under 2.5', outcome: 'Over', odds: 1.92 }, * ], * stake: 10, * }); * ``` */ checkParlay(request: ParlayCheckRequest): Promise; /** * Get automatic settlement feed for ended events. * * @remarks * Settlement is fully automatic — markets resolve without developer intervention * as soon as a game ends. An event appears in the feed when at least one market * is resolved. Poll this method regularly after the game ends to capture all * market resolutions as they arrive gradually. Core markets settle in seconds; * niche markets in minutes. Obscure leagues may take longer. * * @example * ```typescript * // Check settlements every 60 seconds * const settled = await client.getSettlements({ limit: 20 }); * for (const s of settled.settlements) { * console.log(`${s.home_team} vs ${s.away_team}: ${s.resolved_markets_count} markets`); * for (const market of s.resolved_markets) { * // Process each market outcome (won/lost/refund) * } * } * if (settled.has_more) { * // Use settled.next_cursor for next page * } * ``` */ getSettlements(opts?: SettlementFilters): Promise; /** * Get automatic settlement feed for outright/futures markets. * * @remarks * Tournament-level futures (e.g. League Winner, Top Goalscorer) are settled * automatically when officially confirmed by the provider. This endpoint * is separate from match-level settlements. */ getOutrightSettlements(opts?: OutrightSettlementFilters): Promise; /** List tournaments with outright/futures markets */ getOutrights(opts?: BaseSportFilter & { sport_id?: string; country?: string; }): Promise; /** List sports that have outright markets */ getOutrightSports(): Promise; /** Get a specific outright tournament with odds */ getOutright(tournamentId: string, opts?: EventOptions): Promise; } export default FieldFundedSDK; //# sourceMappingURL=index.d.ts.map