odds-api-io 1.3.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +324 -249
  2. package/dist/cjs/client.d.ts +278 -0
  3. package/dist/cjs/client.js +536 -292
  4. package/dist/cjs/client.js.map +1 -1
  5. package/dist/cjs/errors.d.ts +63 -0
  6. package/dist/cjs/errors.js +54 -36
  7. package/dist/cjs/errors.js.map +1 -1
  8. package/dist/cjs/helpers.d.ts +5 -0
  9. package/dist/cjs/helpers.js +13 -0
  10. package/dist/cjs/helpers.js.map +1 -0
  11. package/dist/cjs/index.d.ts +15 -0
  12. package/dist/cjs/index.js +15 -3
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/cjs/package.json +1 -0
  15. package/dist/cjs/types.d.ts +770 -0
  16. package/dist/cjs/types.js +4 -1
  17. package/dist/cjs/types.js.map +1 -1
  18. package/dist/cjs/version.d.ts +1 -0
  19. package/dist/cjs/version.js +5 -0
  20. package/dist/cjs/version.js.map +1 -0
  21. package/dist/cjs/websocket.d.ts +210 -0
  22. package/dist/cjs/websocket.js +405 -0
  23. package/dist/cjs/websocket.js.map +1 -0
  24. package/dist/esm/client.d.ts +278 -0
  25. package/dist/esm/client.js +537 -293
  26. package/dist/esm/client.js.map +1 -1
  27. package/dist/esm/errors.d.ts +63 -0
  28. package/dist/esm/errors.js +49 -34
  29. package/dist/esm/errors.js.map +1 -1
  30. package/dist/esm/helpers.d.ts +5 -0
  31. package/dist/esm/helpers.js +9 -0
  32. package/dist/esm/helpers.js.map +1 -0
  33. package/dist/esm/index.d.ts +15 -0
  34. package/dist/esm/index.js +5 -2
  35. package/dist/esm/index.js.map +1 -1
  36. package/dist/esm/package.json +1 -0
  37. package/dist/esm/types.d.ts +770 -0
  38. package/dist/esm/types.js +4 -1
  39. package/dist/esm/types.js.map +1 -1
  40. package/dist/esm/version.d.ts +1 -0
  41. package/dist/esm/version.js +2 -0
  42. package/dist/esm/version.js.map +1 -0
  43. package/dist/esm/websocket.d.ts +210 -0
  44. package/dist/esm/websocket.js +367 -0
  45. package/dist/esm/websocket.js.map +1 -0
  46. package/dist/types/client.d.ts +155 -195
  47. package/dist/types/client.d.ts.map +1 -1
  48. package/dist/types/errors.d.ts +48 -24
  49. package/dist/types/errors.d.ts.map +1 -1
  50. package/dist/types/helpers.d.ts +6 -0
  51. package/dist/types/helpers.d.ts.map +1 -0
  52. package/dist/types/index.d.ts +8 -3
  53. package/dist/types/index.d.ts.map +1 -1
  54. package/dist/types/types.d.ts +659 -187
  55. package/dist/types/types.d.ts.map +1 -1
  56. package/dist/types/version.d.ts +2 -0
  57. package/dist/types/version.d.ts.map +1 -0
  58. package/dist/types/websocket.d.ts +211 -0
  59. package/dist/types/websocket.d.ts.map +1 -0
  60. package/package.json +46 -16
@@ -0,0 +1,770 @@
1
+ /**
2
+ * TypeScript types for the Odds-API.io v3 REST API.
3
+ *
4
+ * They follow the responses the API serves today. Fields the API leaves out
5
+ * when empty are optional.
6
+ */
7
+ /** A comma-separated string, or an array the SDK joins with commas. */
8
+ export type CommaList<T extends string | number = string> = string | readonly T[];
9
+ /** Market names the API serves. Any other served name is accepted too; see `getMarkets()`. */
10
+ export type MarketName = 'ML' | 'Spread' | 'Totals' | 'ML HT' | 'Spread HT' | 'Totals HT' | 'Totals 2H' | 'Both Teams To Score' | 'Correct Score' | 'Double Chance' | 'Draw No Bet' | 'European Handicap' | 'Half Time / Full Time' | 'Team Total Home' | 'Team Total Away' | 'Corners Spread' | 'Corners Totals' | 'Spread (Games)' | 'Totals (Games)' | 'Player Props' | (string & {});
11
+ export interface Sport {
12
+ name: string;
13
+ slug: string;
14
+ }
15
+ export interface League {
16
+ name: string;
17
+ slug: string;
18
+ /** Number of events currently listed for the league. */
19
+ eventsCount?: number;
20
+ }
21
+ /** A `{ name, slug }` pair, used for sports and leagues inside other objects. */
22
+ export interface NamedSlug {
23
+ name: string;
24
+ slug: string;
25
+ }
26
+ export interface Bookmaker {
27
+ name: string;
28
+ active: boolean;
29
+ /** UTC time the bookmaker was added to the API (RFC 3339). */
30
+ createdAt: string;
31
+ /** `ok`, `degraded` (no update for 60+ minutes, still served) or `down` (left out of odds until it recovers). */
32
+ status: 'ok' | 'degraded' | 'down';
33
+ /** Null when ok. */
34
+ reason: 'maintenance' | 'unavailable' | null;
35
+ }
36
+ export interface SelectedBookmakers {
37
+ bookmakers: string[];
38
+ count: number;
39
+ message?: string;
40
+ /** Number of bookmakers added by a select call. */
41
+ added?: number;
42
+ }
43
+ export interface MarketInfo {
44
+ name: string;
45
+ shape: 'moneyline' | 'line' | 'outcomes' | 'yesno' | 'labelled';
46
+ period: 'match' | 'first-half' | 'second-half' | 'quarter' | 'set' | 'game' | 'inning';
47
+ /** Served on pending events. */
48
+ prematch: boolean;
49
+ /** Served on live events. */
50
+ live: boolean;
51
+ }
52
+ export interface MarketsResponse {
53
+ sport: NamedSlug;
54
+ markets: MarketInfo[];
55
+ }
56
+ /** `/markets` without a sport: market lists keyed by sport slug. */
57
+ export type MarketsBySport = Record<string, MarketInfo[]>;
58
+ export type EventStatus = 'pending' | 'live' | 'settled' | 'cancelled';
59
+ /**
60
+ * Period score keys: `p1`..`pN` (that period only), `ft` (end of regulation),
61
+ * `ot` (after overtime), `ap` (after a penalty shootout), `currentgame` (live tennis),
62
+ * `map1`.. and `map1_score`.. (esports), `inning1`.. (cricket).
63
+ * The older `period1`/`overtime`/`penalties`/`fulltime` keys stop being served on 12 November 2026.
64
+ */
65
+ export type PeriodKey = `p${number}` | 'ft' | 'ot' | 'ap' | 'currentgame' | `map${number}` | `inning${number}`;
66
+ export interface PeriodScore {
67
+ home: number;
68
+ away: number;
69
+ /** Cricket only, when the source publishes it. */
70
+ wickets?: {
71
+ home: number;
72
+ away: number;
73
+ };
74
+ /** Cricket only; 19.3 means 19 overs and 3 balls. */
75
+ overs?: {
76
+ home: number;
77
+ away: number;
78
+ };
79
+ }
80
+ export interface Score {
81
+ /** Headline result: includes overtime, never a penalty shootout. */
82
+ home: number;
83
+ away: number;
84
+ /** Treat every key as optional; which ones appear depends on sport and source. */
85
+ periods?: Partial<Record<PeriodKey, PeriodScore>>;
86
+ }
87
+ export interface Clock {
88
+ minute?: number;
89
+ playedSeconds?: number;
90
+ period?: number;
91
+ running: boolean;
92
+ /** Display text from the feed, not an enum. */
93
+ statusDetail?: string;
94
+ serve?: 'home' | 'away';
95
+ injuryTime?: number;
96
+ /** Unix seconds the current period started (wall time), only for feeds without a played clock. */
97
+ periodStartedAt?: number;
98
+ }
99
+ export interface EsportsDetails {
100
+ game: NamedSlug;
101
+ league: NamedSlug;
102
+ region?: string;
103
+ format?: {
104
+ type: 'bestOf' | 'firstTo' | (string & {});
105
+ games: number;
106
+ };
107
+ }
108
+ export interface Event {
109
+ id: number;
110
+ home: string;
111
+ away: string;
112
+ homeId?: number;
113
+ awayId?: number;
114
+ /** Kickoff, RFC 3339. */
115
+ date: string;
116
+ status: EventStatus;
117
+ sport: NamedSlug;
118
+ league: NamedSlug;
119
+ scores?: Score;
120
+ bookmakerCount?: number;
121
+ /** Live events only, when clock data exists. */
122
+ clock?: Clock;
123
+ /** Esports events only. */
124
+ esports?: EsportsDetails;
125
+ }
126
+ /** Historical events have the same shape as `/events` (no clock or esports block). */
127
+ export type HistoricalEvent = Event;
128
+ export interface Participant {
129
+ id: number;
130
+ name: string;
131
+ sport: string;
132
+ /** Esports only: slug of the game the team plays. */
133
+ game?: string;
134
+ /** Esports only, when known. */
135
+ shortCode?: string;
136
+ }
137
+ /**
138
+ * One line of a market. Prices are decimal strings. Which fields are present
139
+ * depends on the market shape (home/draw/away, over/under, yes/no, label + odds, ...).
140
+ */
141
+ export interface OddsLine {
142
+ hdp?: number;
143
+ label?: string;
144
+ home?: string;
145
+ draw?: string;
146
+ away?: string;
147
+ over?: string;
148
+ under?: string;
149
+ /** Three-way corner lines: over and under both lose on hdp. */
150
+ exactly?: string;
151
+ yes?: string;
152
+ no?: string;
153
+ /** Price of a labelled outcome (Correct Score, Half Time / Full Time, ...). */
154
+ odds?: string;
155
+ '1X'?: string;
156
+ '12'?: string;
157
+ X2?: string;
158
+ odd?: string;
159
+ even?: string;
160
+ none?: string;
161
+ neither?: string;
162
+ /** Stake limit, when the bookmaker publishes one. */
163
+ max?: number;
164
+ homeLink?: string;
165
+ drawLink?: string;
166
+ awayLink?: string;
167
+ layHome?: string;
168
+ layDraw?: string;
169
+ layAway?: string;
170
+ layOver?: string;
171
+ layUnder?: string;
172
+ layYes?: string;
173
+ layNo?: string;
174
+ [field: string]: string | number | undefined;
175
+ }
176
+ export interface Market {
177
+ name: MarketName;
178
+ updatedAt: string;
179
+ odds: OddsLine[];
180
+ }
181
+ /** Response of `/odds`, `/odds/multi`, `/odds/updated` and `/historical/odds`. */
182
+ export interface EventOdds {
183
+ id: number;
184
+ home: string;
185
+ away: string;
186
+ homeId?: number;
187
+ awayId?: number;
188
+ date: string;
189
+ status: EventStatus;
190
+ sport: NamedSlug;
191
+ league: NamedSlug;
192
+ scores?: Score;
193
+ /** Bookmaker links for the event. */
194
+ urls: Record<string, string>;
195
+ /** Bookmakers' own event ids, where known. */
196
+ bookmakerIds?: Record<string, string>;
197
+ /** Markets per bookmaker name. */
198
+ bookmakers: Record<string, Market[]>;
199
+ }
200
+ /** Historical odds and closing lines have the `/odds` shape. */
201
+ export type HistoricalEventOdds = EventOdds;
202
+ /** @deprecated Use `Market`. */
203
+ export type MarketOdds = Market;
204
+ /** @deprecated Use `Market`. */
205
+ export type HistoricalOddsMarket = Market;
206
+ /** @deprecated Use `OddsLine`. */
207
+ export type HistoricalOddsSelection = OddsLine;
208
+ /** @deprecated Use `NamedSlug`. */
209
+ export type HistoricalSport = NamedSlug;
210
+ /** @deprecated Use `NamedSlug`. */
211
+ export type HistoricalLeague = NamedSlug;
212
+ /** @deprecated Use `Score`. */
213
+ export type HistoricalScore = Score;
214
+ export interface OddsMovementPoint {
215
+ home: number;
216
+ draw?: number;
217
+ away: number;
218
+ /** The line at that time, on Spread/Totals. */
219
+ hdp?: string;
220
+ /** Stake limit, when the bookmaker publishes one. */
221
+ max?: number;
222
+ /** Unix milliseconds. */
223
+ timestamp: number;
224
+ }
225
+ /** On Totals the over price is in `home` and the under price in `away`. */
226
+ export interface OddsMovement {
227
+ eventid: string;
228
+ bookmaker: string;
229
+ opening: OddsMovementPoint;
230
+ latest: OddsMovementPoint;
231
+ /** Oldest first; the last entry is the latest price. */
232
+ movements: OddsMovementPoint[];
233
+ }
234
+ export interface UpdatedOddsResult {
235
+ data: EventOdds[];
236
+ /** Pass as `since` on the next call (from the X-Next-Since header). */
237
+ nextSince: number | null;
238
+ /** Server unix time (X-Server-Time). */
239
+ serverTime: number | null;
240
+ /** Requested market names that do not exist (X-Unknown-Markets). */
241
+ unknownMarkets: string[];
242
+ }
243
+ export interface OddsSnapshot {
244
+ data: EventOdds[];
245
+ /** WebSocket sequence at the time of the snapshot (X-OddsAPI-Seq); use as `lastSeq`. */
246
+ seq: number | null;
247
+ }
248
+ export interface SummaryOutcome {
249
+ best: number;
250
+ bestBookmakers: string[];
251
+ average: number;
252
+ median: number;
253
+ worst: number;
254
+ /** Margin-free price; needs 3 complete books. */
255
+ fair?: number;
256
+ sharpFair?: number;
257
+ excluded?: number;
258
+ }
259
+ export interface SummaryExchangeQuote {
260
+ best: number;
261
+ venue: string;
262
+ liquidity?: number;
263
+ currency?: string;
264
+ }
265
+ export interface SummaryLine {
266
+ hdp: number | null;
267
+ main: boolean;
268
+ books: number;
269
+ fairBooks?: number;
270
+ /** Keyed home/draw/away, over/under or yes/no. */
271
+ outcomes: Record<string, SummaryOutcome>;
272
+ payout?: {
273
+ best: number;
274
+ average: number;
275
+ };
276
+ /** With `includeExchanges: true`. */
277
+ exchanges?: Record<string, SummaryExchangeQuote>;
278
+ }
279
+ export interface SummaryMarket {
280
+ name: MarketName;
281
+ lines: SummaryLine[];
282
+ }
283
+ export interface EventSummary {
284
+ /** True on plans below Growth, which get a fixed sample response. */
285
+ demo?: boolean;
286
+ message?: string;
287
+ eventId: string;
288
+ home: string;
289
+ away: string;
290
+ date: string;
291
+ status: EventStatus;
292
+ computedAt: string;
293
+ markets: SummaryMarket[];
294
+ }
295
+ /** Short event info attached with `includeEventDetails: true`. */
296
+ export interface EventInfo {
297
+ home: string;
298
+ away: string;
299
+ date: string;
300
+ sport: string;
301
+ league: string;
302
+ }
303
+ export type BetSide = 'home' | 'away' | 'draw' | 'over' | 'under';
304
+ export interface ArbitrageLeg {
305
+ side: BetSide;
306
+ bookmaker: string;
307
+ /** Decimal price as a string. */
308
+ odds: string;
309
+ /** Price after exchange fees, only when fees apply. */
310
+ netOdds?: string;
311
+ maxStake?: number;
312
+ oddsUpdatedAt?: string;
313
+ /** Bookmaker link, or "N/A". */
314
+ href?: string;
315
+ directLink?: string;
316
+ label?: string;
317
+ bookmakerFixtureId?: string;
318
+ }
319
+ export interface OptimalStake {
320
+ side: string;
321
+ bookmaker: string;
322
+ stake: number;
323
+ potentialReturn: number;
324
+ }
325
+ export interface ArbitrageBet {
326
+ id: string;
327
+ eventId: number;
328
+ market: {
329
+ name: MarketName;
330
+ hdp?: number;
331
+ label?: string;
332
+ };
333
+ /** Percent of totalStake at the quoted prices after fees (2.48 = 2.48%). */
334
+ profitMargin: number;
335
+ impliedProbability: number;
336
+ totalStake: number;
337
+ legs: ArbitrageLeg[];
338
+ optimalStakes: OptimalStake[];
339
+ updatedAt: string;
340
+ firstSeenAt?: string;
341
+ event?: EventInfo;
342
+ }
343
+ export interface ValueBet {
344
+ id: string;
345
+ eventId: number;
346
+ bookmaker: string;
347
+ market: {
348
+ name: MarketName;
349
+ hdp?: number;
350
+ home: string;
351
+ draw?: string;
352
+ away: string;
353
+ max: number | null;
354
+ };
355
+ betSide?: string;
356
+ /** 0.0523 means +5.23% EV. */
357
+ expectedValue: number;
358
+ expectedValueUpdatedAt: string;
359
+ firstSeenAt?: string;
360
+ bookmakerOddsUpdatedAt?: string;
361
+ bookmakerOdds: {
362
+ home: string;
363
+ away: string;
364
+ draw?: string;
365
+ hdp?: string;
366
+ href?: string;
367
+ homeDirectLink?: string;
368
+ drawDirectLink?: string;
369
+ awayDirectLink?: string;
370
+ };
371
+ event?: EventInfo;
372
+ }
373
+ export interface DroppingOddsEntry {
374
+ eventId: number;
375
+ event?: {
376
+ home: string;
377
+ away: string;
378
+ date: string;
379
+ sport: NamedSlug;
380
+ league: NamedSlug;
381
+ };
382
+ market: {
383
+ name: MarketName;
384
+ hdp?: number;
385
+ /** Player name on player prop markets. */
386
+ label?: string;
387
+ };
388
+ betSide: BetSide;
389
+ odds: {
390
+ opening: number;
391
+ current: number;
392
+ drop: {
393
+ sinceOpening: number;
394
+ '12h': number | null;
395
+ '24h': number | null;
396
+ '48h': number | null;
397
+ };
398
+ };
399
+ lastMovedAt: number | null;
400
+ updatedAt: number;
401
+ }
402
+ export interface DroppingOddsPage {
403
+ data: DroppingOddsEntry[];
404
+ /** X-Total-Count */
405
+ total: number | null;
406
+ /** X-Page */
407
+ page: number | null;
408
+ /** X-Per-Page */
409
+ perPage: number | null;
410
+ /** X-Updated-At, unix milliseconds. */
411
+ updatedAt: number | null;
412
+ }
413
+ export interface Settlement {
414
+ eventId: number;
415
+ sport: string;
416
+ status: 'pending' | 'live' | 'awaiting_result' | 'settled' | 'cancelled';
417
+ /** True when you can stop polling. */
418
+ final: boolean;
419
+ settledAt?: string;
420
+ /** Settled events only. */
421
+ scores?: Score;
422
+ }
423
+ export interface SettlementsResponse {
424
+ settlements: Settlement[];
425
+ /** Ids that were never seen. */
426
+ notFound: string[];
427
+ }
428
+ export interface GradeSelection {
429
+ /** Echoed back, up to 64 characters. */
430
+ ref?: string;
431
+ eventId: number | string;
432
+ /** Market name exactly as served on /odds (case-insensitive). */
433
+ market: MarketName;
434
+ /** home, away, draw, over, under, yes, no, odd, even, 1x, 12, x2, none, neither, or an HT/FT pair such as draw/home. */
435
+ side?: string;
436
+ /** The line as served on /odds, stated for the home side; a multiple of 0.25. */
437
+ hdp?: number;
438
+ /** Required for Player Props and labelled markets. */
439
+ label?: string;
440
+ tieRule?: 'lose' | 'void';
441
+ }
442
+ export type GradeResult = 'won' | 'lost' | 'void' | 'half_won' | 'half_lost' | 'pending' | 'ungradeable';
443
+ export type GradeReason = 'push' | 'event_cancelled' | 'event_not_started' | 'event_live' | 'awaiting_result' | 'awaiting_stats' | 'event_not_found' | 'unsupported_market' | 'invalid_side' | 'invalid_line' | 'invalid_label' | 'incomplete_score' | 'ambiguous_tie' | 'player_not_matched' | 'stats_unavailable' | 'result_unavailable';
444
+ export interface Grade {
445
+ ref?: string;
446
+ eventId: number;
447
+ result: GradeResult;
448
+ reason: GradeReason | null;
449
+ /** True when you can stop polling this selection. */
450
+ final: boolean;
451
+ /** The score the verdict was computed from, on graded score markets. */
452
+ basis?: {
453
+ scope: string;
454
+ home: number;
455
+ away: number;
456
+ };
457
+ }
458
+ export interface GradesResponse {
459
+ grades: Grade[];
460
+ }
461
+ export type OutrightMarketName = 'Winner' | 'Top 5' | 'Top 5 (Incl. Ties)' | 'Top 10' | 'Top 10 (Incl. Ties)' | 'Top 20' | 'Top 20 (Incl. Ties)' | 'Make Cut' | (string & {});
462
+ export interface Outright {
463
+ id: number;
464
+ name: string;
465
+ date: string;
466
+ status: EventStatus;
467
+ sport: NamedSlug;
468
+ league: NamedSlug;
469
+ /** Bookmakers you can request that currently price the tournament. */
470
+ bookmakerCount: number;
471
+ }
472
+ /** Winner and Top N runners: a back price, plus a lay price on exchanges and prediction markets. */
473
+ export interface OutrightPriceRunner {
474
+ label: string;
475
+ participantId: number;
476
+ odds: string;
477
+ layOdds?: string;
478
+ }
479
+ /** Make Cut runners: yes/no prices, plus lay prices on exchanges. */
480
+ export interface OutrightYesNoRunner {
481
+ label: string;
482
+ participantId: number;
483
+ yes?: string;
484
+ no?: string;
485
+ layYes?: string;
486
+ layNo?: string;
487
+ }
488
+ export type OutrightRunner = OutrightPriceRunner | OutrightYesNoRunner;
489
+ export interface OutrightMarket {
490
+ name: OutrightMarketName;
491
+ updatedAt: string;
492
+ odds: OutrightRunner[];
493
+ }
494
+ export interface OutrightOdds {
495
+ id: number;
496
+ name: string;
497
+ date: string;
498
+ status: EventStatus;
499
+ sport: NamedSlug;
500
+ league: NamedSlug;
501
+ /** Empty for settled and cancelled tournaments. */
502
+ bookmakers: Record<string, OutrightMarket[]>;
503
+ }
504
+ export interface OutrightResultRow {
505
+ label: string;
506
+ participantId: number;
507
+ /** Shared by tied golfers; null for cut, withdrawn and disqualified. */
508
+ position: number | null;
509
+ tied: boolean;
510
+ /** Null for events without a cut. */
511
+ madeCut: boolean | null;
512
+ status: 'finished' | 'cut' | 'withdrawn' | 'disqualified';
513
+ }
514
+ export interface OutrightResults {
515
+ id: number;
516
+ name: string;
517
+ status: EventStatus;
518
+ /** Empty until the tournament is settled. */
519
+ results: OutrightResultRow[];
520
+ /** Participant ids per market name. */
521
+ winners: Partial<Record<OutrightMarketName, number[]>>;
522
+ }
523
+ export interface Mapping {
524
+ eventId: number;
525
+ home: string;
526
+ away: string;
527
+ date: string;
528
+ sport: NamedSlug;
529
+ league: NamedSlug;
530
+ bookmaker: string;
531
+ market: MarketName;
532
+ label?: string;
533
+ hdp?: number;
534
+ side: 'home' | 'away' | 'draw' | 'over' | 'under' | 'yes' | 'no';
535
+ nativeEventId?: string;
536
+ marketId: string;
537
+ outcomeId: string;
538
+ outcomeLabel?: string;
539
+ extra?: Record<string, unknown>;
540
+ active: boolean;
541
+ firstSeenAt: string;
542
+ lastCheckedAt: string;
543
+ }
544
+ export interface MappingsPage {
545
+ data: Mapping[];
546
+ /** Set in bulk sync while more pages remain. */
547
+ nextCursor: string | null;
548
+ }
549
+ export interface RateLimitInfo {
550
+ limit: number | null;
551
+ remaining: number | null;
552
+ /** When the hourly window resets. */
553
+ reset: Date | null;
554
+ }
555
+ export interface OddsAPIClientConfig {
556
+ /** Your Odds-API.io API key. */
557
+ apiKey: string;
558
+ /** Base API URL (default: https://api.odds-api.io/v3). */
559
+ baseUrl?: string;
560
+ /** Request timeout in milliseconds (default: 10000). */
561
+ timeout?: number;
562
+ /**
563
+ * Retries on 5xx, network errors and timeouts, and on 429 when the server
564
+ * asks for a wait no longer than `maxRetryDelay` (default: 2). Set 0 to disable.
565
+ * Bookmaker selection changes (PUT) are never retried.
566
+ */
567
+ maxRetries?: number;
568
+ /** Longest wait between retries in milliseconds (default: 10000). */
569
+ maxRetryDelay?: number;
570
+ /** A custom fetch implementation (default: the global fetch). */
571
+ fetch?: typeof fetch;
572
+ }
573
+ export interface GetLeaguesOptions {
574
+ /** Include leagues without current events. */
575
+ all?: boolean;
576
+ }
577
+ export interface GetEventsParams {
578
+ sport: string;
579
+ league?: string;
580
+ participantId?: number;
581
+ /** One status or a list: pending, live, settled, cancelled. */
582
+ status?: EventStatus | CommaList<EventStatus>;
583
+ /** RFC 3339. */
584
+ from?: string;
585
+ /** RFC 3339. Defaults to 14 days from now. */
586
+ to?: string;
587
+ /** Only events with odds from this bookmaker. */
588
+ bookmaker?: string;
589
+ /** Max events per response (capped at 5000). */
590
+ limit?: number;
591
+ /** Offset for pagination. */
592
+ skip?: number;
593
+ }
594
+ export interface SearchEventsOptions {
595
+ /** `upcoming` (default) or `live`. */
596
+ status?: 'upcoming' | 'live';
597
+ }
598
+ export interface GetHistoricalEventsParams {
599
+ sport: string;
600
+ league: string;
601
+ /** RFC 3339. The span from `from` to `to` is at most 31 days. */
602
+ from: string;
603
+ /** RFC 3339. */
604
+ to: string;
605
+ }
606
+ export interface SearchHistoricalEventsParams {
607
+ /** At least 3 characters. */
608
+ query: string;
609
+ sport?: string;
610
+ /** RFC 3339. Defaults to 31 days before `to`. Span at most 31 days. */
611
+ from?: string;
612
+ /** RFC 3339. Defaults to now. */
613
+ to?: string;
614
+ }
615
+ export interface GetOddsParams {
616
+ eventId: string | number;
617
+ /** Bookmaker names, max 30. */
618
+ bookmakers: CommaList;
619
+ /** Market names, max 40. Strongly recommended: a full response can be very large. */
620
+ markets?: CommaList<MarketName>;
621
+ /** Adds the WebSocket sequence as the X-OddsAPI-Seq header (see `getOddsSnapshot`). */
622
+ includeSeq?: boolean;
623
+ }
624
+ export interface GetMultiEventOddsParams {
625
+ /** Up to 10 event ids. */
626
+ eventIds: CommaList<string | number>;
627
+ bookmakers: CommaList;
628
+ markets?: CommaList<MarketName>;
629
+ includeSeq?: boolean;
630
+ }
631
+ export interface GetHistoricalOddsParams {
632
+ eventId: string | number;
633
+ bookmakers: CommaList;
634
+ markets?: CommaList<MarketName>;
635
+ }
636
+ export interface GetClosingLinesParams {
637
+ sport: string;
638
+ /** Up to 10 league slugs. */
639
+ leagues: CommaList;
640
+ /** RFC 3339. */
641
+ from: string;
642
+ /** RFC 3339, at most 366 days after `from`. */
643
+ to: string;
644
+ markets: CommaList<MarketName>;
645
+ /** Max 30. */
646
+ bookmakers: CommaList;
647
+ /** Capped at 100. */
648
+ limit?: number;
649
+ skip?: number;
650
+ }
651
+ export interface GetOddsMovementParams {
652
+ eventId: string | number;
653
+ bookmaker: string;
654
+ market: MarketName;
655
+ /** Leave out for the main line or markets without a line. */
656
+ marketLine?: string | number;
657
+ }
658
+ export interface GetUpdatedOddsSinceParams {
659
+ /** Unix seconds, no more than 90 seconds old (or the previous X-Next-Since). */
660
+ since: number;
661
+ bookmaker: string;
662
+ sport: string;
663
+ /** Required. Market names, max 40. */
664
+ markets: CommaList<MarketName>;
665
+ /** 1 to 10000. */
666
+ limit?: number;
667
+ }
668
+ export interface PollUpdatedOddsParams extends Omit<GetUpdatedOddsSinceParams, 'since'> {
669
+ /** First `since`; defaults to now minus 20 seconds. */
670
+ since?: number;
671
+ /** Delay between polls in milliseconds (default: 10000). */
672
+ intervalMs?: number;
673
+ /** Stops the loop. */
674
+ signal?: AbortSignal;
675
+ }
676
+ export interface GetOddsSummaryParams {
677
+ eventId: string | number;
678
+ /** Max 20. Default ML,Spread,Totals. */
679
+ markets?: CommaList<MarketName>;
680
+ /** `main` (default) or `all`. */
681
+ lines?: 'main' | 'all';
682
+ bookmakers?: CommaList;
683
+ includeExchanges?: boolean;
684
+ }
685
+ export interface GetOddsSummaryMultiParams extends Omit<GetOddsSummaryParams, 'eventId'> {
686
+ /** Up to 10 event ids. */
687
+ eventIds: CommaList<string | number>;
688
+ }
689
+ export interface GetParticipantsParams {
690
+ sport: string;
691
+ search?: string;
692
+ }
693
+ export interface GetArbitrageBetsParams {
694
+ bookmakers: CommaList;
695
+ sport?: string;
696
+ /** Requires sport. */
697
+ league?: string;
698
+ markets?: CommaList<MarketName>;
699
+ /** Minimum profitMargin in percent, 0 to 100. */
700
+ minProfit?: number;
701
+ /** Every bookmaker combination per event, market and line, best first. */
702
+ allCombinations?: boolean;
703
+ /** Default 50, max 500. */
704
+ limit?: number;
705
+ includeEventDetails?: boolean;
706
+ }
707
+ export interface GetValueBetsParams {
708
+ bookmaker: string;
709
+ sport?: string;
710
+ /** Requires sport. */
711
+ league?: string;
712
+ includeEventDetails?: boolean;
713
+ }
714
+ export interface GetDroppingOddsParams {
715
+ sport?: string;
716
+ /** Requires sport. Not with `leagues`. */
717
+ league?: string;
718
+ leagues?: CommaList;
719
+ markets?: CommaList<MarketName>;
720
+ /** @deprecated Use `markets`. Sent as `markets`. */
721
+ market?: string;
722
+ timeWindow?: 'opening' | '12h' | '24h' | '48h';
723
+ sort?: 'drop' | 'recent' | 'kickoff';
724
+ minDrop?: number;
725
+ /** Max 200. */
726
+ limit?: number;
727
+ /** 1-indexed. */
728
+ page?: number;
729
+ includeEventDetails?: boolean;
730
+ }
731
+ export interface GetOutrightsParams {
732
+ /** Golf today. */
733
+ sport: string;
734
+ /** pga-tour, dp-world-tour, liv-golf or majors. */
735
+ league?: string;
736
+ /** Default pending,live. */
737
+ status?: EventStatus | CommaList<EventStatus>;
738
+ }
739
+ export interface GetOutrightOddsParams {
740
+ id: string | number;
741
+ /** Max 30. */
742
+ bookmakers: CommaList;
743
+ }
744
+ export interface GetMappingsParams {
745
+ bookmaker: string;
746
+ eventId?: string | number;
747
+ /** Up to 10. */
748
+ eventIds?: CommaList<string | number>;
749
+ marketId?: string;
750
+ /** Up to 10. */
751
+ marketIds?: CommaList;
752
+ outcomeId?: string;
753
+ /** Exact market name as in /odds, case-sensitive. */
754
+ market?: string;
755
+ active?: boolean;
756
+ /** Bulk sync only. */
757
+ sport?: string;
758
+ /** Bulk sync only, requires sport. */
759
+ league?: string;
760
+ /** Bulk sync only, 1 to 5000. */
761
+ limit?: number;
762
+ /** Bulk sync only: nextCursor of the previous page. */
763
+ cursor?: string;
764
+ }
765
+ export interface PageOptions {
766
+ /** Page size per request. */
767
+ pageSize?: number;
768
+ /** Stop after this many pages. */
769
+ maxPages?: number;
770
+ }