@ufcalendar/sdk 0.9.1 → 0.10.0
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.
- package/README.md +40 -2
- package/dist/index.cjs +67 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2072 -221
- package/dist/index.d.ts +2072 -221
- package/dist/index.js +67 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,16 +66,18 @@ List endpoints are **async generators** that follow `meta.pagination.next_cursor
|
|
|
66
66
|
| `fightOddsHistory(id, { from, to })` | `GET /v1/fights/{id}/odds/history` — every consensus point, oldest first (async generator; Pro plans and up) |
|
|
67
67
|
| `findFights({ org, titleOnly, method, division, fighter, winner, from, to, mainEventsOnly, order, limit })` | `GET /v1/fights/search` — completed bouts, filtered, newest first (at least one narrowing filter; 25 a page, 10 pages deep) |
|
|
68
68
|
| `fightScorecards(id)` | `GET /v1/fights/{id}/scorecards` — judges, rounds, totals, deductions |
|
|
69
|
+
| `fightTimeline(id)` / `fightPositions(id)` | `GET /v1/fights/{id}/timeline` / `…/positions` — settled UFC bouts: the official in-fight log (every action, referee stoppages with their reason and real length, every confirmed foul and the foul counts per corner; from June 2013, stoppage reasons from 8 December 2018) and position stats for the bout and each round (time at distance / in the clinch / on the ground, control by position, strikes by position and target; from 2007). Pro plans and up |
|
|
69
70
|
| `judges({ q, org, minFights })` / `judge(id)` / `judgeScorecards(id)` | `GET /v1/judges` / `…/{id}` / `…/{id}/scorecards` (`lastMeta.league` = baseline rates; each card row flags `lone_dissent` / `split` and lists `colleagues`) |
|
|
70
71
|
| `referees({ q, org })` / `referee(slug)` / `refereeFights(slug)` | `GET /v1/referees` / `…/{slug}` / `…/{slug}/fights` — referees across the launch promotions: bouts, finish rate, method mix, average fight time; the bouts each one worked (async iterators for the lists) |
|
|
71
72
|
| `coverage({ org })` | `GET /v1/coverage` — what the database holds per promotion per year: events, settled bouts, and the share with stats, round stats, commission scorecards and a consensus odds line |
|
|
72
73
|
| `splitDecisions({ org, from, to, limit })` | `GET /v1/scorecards/splits` — split and majority decisions, newest first, with every judge's card and the dissenters named (paginated) |
|
|
73
74
|
| `fighters({ q, org, country })` / `fighter(slug, { include: ['bonuses', 'credentials'] })` | `GET /v1/fighters` / `…/{slug}` (always carries `next_fight` / `last_fight`; `bonuses` = the UFC bonus ledger; `credentials` = grappling and wrestling pedigree, gyms and coaches, each row sourced and confidence-graded) |
|
|
74
75
|
| `fighterHistory` / `fighterStats` / `fighterRankings` / `fighterPowerIndex` | `GET /v1/fighters/{slug}/…` |
|
|
76
|
+
| `fighterDiscipline(slug)` / `fighterPositions(slug)` | `GET /v1/fighters/{slug}/discipline` / `…/positions` — the confirmed fouls in a fighter's UFC bouts, committed and drawn (eye pokes and low blows from the official in-fight log, plus any other foul confirmed by the athletic commission's point deduction or by the official result; counts by kind, points deducted, every incident), and the career position profile (share of cage time by range, control for and against by position). `null` under 3 tracked bouts. Pro plans and up |
|
|
75
77
|
| `rankings(org, { date })` / `divisionRankings(org, division)` / `champions()` | `GET /v1/rankings/…` / `/v1/champions` (entries carry `movement`, `is_new`, `country_code`; `lastMeta` names the previous/next snapshot) |
|
|
76
78
|
| `powerIndex(org, { view, division, days, limit })` / `predictionsUpcoming({ event })` | `GET /v1/power-index/{org}` (`view`: `current` · `movers` · `peaks`) / `/v1/predictions/upcoming` |
|
|
77
79
|
| `matchmaker(org, { division, limit })` / `whosNext(fighter, { limit })` | `GET /v1/matchmaker/{org}` / `…/next/{fighter}` — UFCalendar's matchmaker: the fights worth making (scored 0–100, per division or across the roster; not bookings), and one fighter's best next opponents with the win probability for each and the bout already booked |
|
|
78
|
-
| `leaderboard(org, metric, { division, country, population, limit })` / `recordBook(org, { division, country, population, scope, top })` | `GET /v1/stats/leaders` / `…/record-book` — the Record Book: one leaderboard (
|
|
80
|
+
| `leaderboard(org, metric, { division, country, population, limit })` / `recordBook(org, { division, country, population, scope, top })` | `GET /v1/stats/leaders` / `…/record-book` — the Record Book: one leaderboard (57 metrics (9 discipline boards need Pro+); ties flagged, sample size on every row), or every board's top rows grouped by category |
|
|
79
81
|
| `orgDivision(org, division)` | `GET /v1/orgs/{org}/divisions/{division}` — one weight class: rankings board, upcoming bouts, latest results, roster by recency |
|
|
80
82
|
| `yearStats(year, { org })` | `GET /v1/stats/years/{year}` — one calendar year in numbers for one promotion (or every covered one): methods, divisions, fastest finishes, upsets, Power Index climbers, busiest fighters, countries, judges |
|
|
81
83
|
| `compare(a, b)` | `GET /v1/compare` — two fighters side by side: bios, career stats, strike mix, streaks, previous meetings, common opponents, booked bout, model prediction (UFC), Power Index |
|
|
@@ -88,7 +90,7 @@ List endpoints are **async generators** that follow `meta.pagination.next_cursor
|
|
|
88
90
|
| `calendarIcsUrl(org)` | `GET /v1/calendar/{org}.ics` (URL builder — no request) |
|
|
89
91
|
| `get(path, params)` / `getWithMeta(path, params)` | escape hatch for anything new |
|
|
90
92
|
|
|
91
|
-
Hand-written types cover events, fights, fighters, rankings, scorecards, consensus odds and plans; the generated `paths` / `operations` types from the OpenAPI document are exported for everything else.
|
|
93
|
+
Hand-written types cover events, fights, fighters, rankings, scorecards, consensus odds, the fight log, position stats and plans; the generated `paths` / `operations` types from the OpenAPI document are exported for everything else.
|
|
92
94
|
|
|
93
95
|
## Consensus odds
|
|
94
96
|
|
|
@@ -105,6 +107,42 @@ for await (const point of api.fightOddsHistory(83379)) { // Pro plans and up
|
|
|
105
107
|
One anonymised UFCalendar consensus line per corner across the sportsbooks we track;
|
|
106
108
|
book identities are never exposed. Information only, not betting advice.
|
|
107
109
|
|
|
110
|
+
## Fight log and position stats (Pro and up)
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
const log = await api.fightTimeline(59652); // UFC 286, Edwards vs Usman
|
|
114
|
+
// Every referee stoppage; is_foul says whether a record confirms a foul.
|
|
115
|
+
for (const s of log.stoppages) console.log(s.round, s.elapsed_sec, s.reason, s.duration_sec, s.is_foul, s.foul, s.foul_basis);
|
|
116
|
+
// Every confirmed foul, in fight order.
|
|
117
|
+
for (const i of log.incidents) console.log(i.foul, i.basis, i.committed_by, i.points_deducted, i.ended_bout);
|
|
118
|
+
console.log(log.fouls.a); // what corner a committed: eye_pokes, low_blows, other, total, points_deducted
|
|
119
|
+
|
|
120
|
+
const pos = await api.fightPositions(59652);
|
|
121
|
+
const a = pos.totals[0];
|
|
122
|
+
console.log(a?.time.distance_sec, a?.time.clinch_sec, a?.time.ground_sec, a?.control.total_sec);
|
|
123
|
+
|
|
124
|
+
const d = await api.fighterDiscipline('leon-edwards'); // null under 3 tracked bouts
|
|
125
|
+
console.log(d?.committed, d?.points_deducted, d?.fouls_per_15, d?.incidents.length);
|
|
126
|
+
// reason is the foul; basis is the record behind it.
|
|
127
|
+
for (const i of d?.incidents ?? []) console.log(i.date, i.role, i.reason, i.basis, i.points_deducted, i.ended_bout);
|
|
128
|
+
const p = await api.fighterPositions('leon-edwards');
|
|
129
|
+
console.log(p?.time.distance_share, p?.control.for_sec, p?.control.against_sec);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Settled UFC bouts only (Contender Series included): the log from June 2013, stoppage
|
|
133
|
+
reasons from 8 December 2018, positions reliably from 2007.
|
|
134
|
+
|
|
135
|
+
Fouls are confirmed fouls. The log labels only two, the eye poke and the low blow; any
|
|
136
|
+
other foul (an illegal knee to a grounded opponent, an upkick, a headbutt, a bite, a fence
|
|
137
|
+
grab) reaches it as a `generic` stoppage naming nobody, so it is reported only when a
|
|
138
|
+
record confirms it: `log` (the labelled row), `deduction` (the athletic commission took a
|
|
139
|
+
point) or `result` (the bout ended on it: a disqualification or a "could not continue").
|
|
140
|
+
A `generic` stoppage with no record behind it has `is_foul` false. The fighter on a foul
|
|
141
|
+
is the one who committed it. A recorded foul is not a ruling on intent.
|
|
142
|
+
|
|
143
|
+
In position stats `null` means not tracked for that bout and `0` is a real zero. Below Pro these throw
|
|
144
|
+
`FightAPIError` 403 `tier_required`.
|
|
145
|
+
|
|
108
146
|
## Agents and MCP
|
|
109
147
|
|
|
110
148
|
The same data is a Model Context Protocol server, so an agent can call it without an HTTP client:
|
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,7 @@ __export(index_exports, {
|
|
|
30
30
|
module.exports = __toCommonJS(index_exports);
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = "0.
|
|
33
|
+
var VERSION = "0.10.0";
|
|
34
34
|
|
|
35
35
|
// src/client.ts
|
|
36
36
|
var DEFAULT_BASE_URL = "https://api.ufcalendar.com/v1";
|
|
@@ -371,6 +371,45 @@ var FightAPI = class {
|
|
|
371
371
|
fightScorecards(fightId) {
|
|
372
372
|
return this.get(`fights/${encodeURIComponent(String(fightId))}/scorecards`);
|
|
373
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* The official in-fight log of one settled UFC bout (Pro plans and up; a
|
|
376
|
+
* lower plan throws `FightAPIError` 403 `tier_required`): every logged
|
|
377
|
+
* action in order, the referee stoppages paired with their reason and
|
|
378
|
+
* real length, and every confirmed foul of the bout.
|
|
379
|
+
*
|
|
380
|
+
* The log labels only two fouls, the eye poke and the low blow. Any other
|
|
381
|
+
* foul (an illegal knee to a grounded opponent, an upkick, a headbutt, a
|
|
382
|
+
* bite, a fence grab) reaches it as a `generic` stoppage naming nobody, so
|
|
383
|
+
* a foul is reported only when a record confirms it (`foul_basis` /
|
|
384
|
+
* `basis`): `log` (the labelled row), `deduction` (the athletic commission
|
|
385
|
+
* took a point) or `result` (the bout ended on it: a disqualification or a
|
|
386
|
+
* "could not continue"). On a stoppage, `is_foul` says whether a foul is
|
|
387
|
+
* confirmed, `foul` what it was, `committed_by` who committed it (null
|
|
388
|
+
* when no record names a fighter), `points_deducted` and `ended_bout`; a
|
|
389
|
+
* `generic` stoppage with no record behind it has `is_foul: false`.
|
|
390
|
+
* `incidents` lists every confirmed foul in fight order, including one
|
|
391
|
+
* with no stoppage in the log; `fouls.a` / `fouls.b` count what each
|
|
392
|
+
* corner committed (`eye_pokes`, `low_blows`, `other`, `total`,
|
|
393
|
+
* `points_deducted`). A recorded foul is not a ruling on intent.
|
|
394
|
+
*
|
|
395
|
+
* Coverage: UFC bouts from June 2013, stoppage reasons
|
|
396
|
+
* from 8 December 2018 (`lastMeta.has_stoppage_reasons`). A bout with no
|
|
397
|
+
* log, or one not settled yet, resolves with empty lists and
|
|
398
|
+
* `lastMeta.note`.
|
|
399
|
+
*/
|
|
400
|
+
fightTimeline(fightId) {
|
|
401
|
+
return this.get(`fights/${encodeURIComponent(String(fightId))}/timeline`);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Position stats of one settled UFC bout (Pro plans and up): where it was
|
|
405
|
+
* fought (`time`, shared by both fighters), each fighter's `control` by
|
|
406
|
+
* position, and strikes by position and target — `totals` for the whole
|
|
407
|
+
* bout, `rounds` per round. `null` means not tracked for that bout; `0`
|
|
408
|
+
* is a real zero. Tracked reliably from 2007.
|
|
409
|
+
*/
|
|
410
|
+
fightPositions(fightId) {
|
|
411
|
+
return this.get(`fights/${encodeURIComponent(String(fightId))}/positions`);
|
|
412
|
+
}
|
|
374
413
|
/**
|
|
375
414
|
* Completed bouts, filtered — newest first unless `order: 'oldest'`. At
|
|
376
415
|
* least one narrowing filter is required (`titleOnly`, `method`,
|
|
@@ -488,6 +527,33 @@ var FightAPI = class {
|
|
|
488
527
|
`fighters/${encodeURIComponent(String(idOrSlug))}/power-index`
|
|
489
528
|
);
|
|
490
529
|
}
|
|
530
|
+
/**
|
|
531
|
+
* The confirmed fouls in a fighter's UFC bouts since 8 December 2018 (Pro
|
|
532
|
+
* plans and up), committed and drawn: eye pokes and low blows from the
|
|
533
|
+
* official in-fight log, plus any other foul (an illegal knee to a
|
|
534
|
+
* grounded opponent, an upkick, a headbutt, a bite, a fence grab)
|
|
535
|
+
* confirmed by the athletic commission's point deduction or by the
|
|
536
|
+
* official result. `committed` / `drawn` count `total`, `eye_pokes`,
|
|
537
|
+
* `low_blows` and `other`; `points_deducted` is what the commission has
|
|
538
|
+
* taken from this fighter; `incidents` lists every confirmed foul, most
|
|
539
|
+
* recent first, with `reason` (the foul), `basis` (`log`, `deduction` or
|
|
540
|
+
* `result`), `points_deducted` and `ended_bout`. A `generic` stoppage with
|
|
541
|
+
* no record behind it is never counted. A recorded foul is not a ruling on
|
|
542
|
+
* intent. Resolves `null` (with `lastMeta.note`) under 3 tracked bouts
|
|
543
|
+
* with no recorded foul.
|
|
544
|
+
*/
|
|
545
|
+
fighterDiscipline(idOrSlug) {
|
|
546
|
+
return this.get(`fighters/${encodeURIComponent(String(idOrSlug))}/discipline`);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* A fighter's career position profile (Pro plans and up): the share of
|
|
550
|
+
* cage time at distance, in the clinch and on the ground, and control
|
|
551
|
+
* seconds for and against by position. Resolves `null` (with
|
|
552
|
+
* `lastMeta.note`) under 3 bouts with tracked positions.
|
|
553
|
+
*/
|
|
554
|
+
fighterPositions(idOrSlug) {
|
|
555
|
+
return this.get(`fighters/${encodeURIComponent(String(idOrSlug))}/positions`);
|
|
556
|
+
}
|
|
491
557
|
/**
|
|
492
558
|
* Two fighters side by side (slugs or ids): bios with age, career stats,
|
|
493
559
|
* strike mix, win streaks, previous meetings, common opponents, the booked
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/version.ts","../src/client.ts"],"sourcesContent":["export { FightAPI, FightAPIError, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, MAX_RETRY_AFTER_SECONDS } from './client';\nexport type { FightAPIOptions, Query, QueryValue } from './client';\nexport { VERSION } from './version';\nexport type * from './types';\n/** The generated OpenAPI path map, for anything the hand-written types above\n * do not cover. Regenerated by `pnpm gen:types` from apps/api/openapi.json. */\nexport type { paths, operations } from './schema';\n","/** Kept in lockstep with package.json and the User-Agent by\n * `apps/api/src/surfaces.test.ts`. Bump all three together. */\nexport const VERSION = '0.9.1';\n","/**\n * Thin, dependency-free client for https://api.ufcalendar.com/v1.\n *\n * Every method returns the parsed `data` value of the JSON envelope\n * (`{\"data\": ..., \"meta\": ...}`); list endpoints are async generators that\n * follow cursor pagination for you. Errors throw `FightAPIError` carrying\n * the API's `code`, `message` and `requestId` — quote the request id when\n * you write to api@ufcalendar.com.\n *\n * Mirrors sdk/python/ufcalendar/client.py one method per endpoint, in\n * camelCase. The two clients are kept in lockstep by\n * `apps/api/src/surfaces.test.ts`.\n *\n * Odds are the UFCalendar consensus line: one anonymised line per corner\n * across the sportsbooks we track (`sources` = how many books backed each\n * point; book identities are never exposed). Information only, not betting\n * advice. Fighter `images` are Wikimedia\n * Commons / Creative Commons files — the `license` and `artist` fields you\n * receive must be displayed as a credit.\n */\nimport { VERSION } from './version';\nimport type {\n Article,\n FightStatLine,\n OrgCoverage,\n Referee,\n RefereeFightRow,\n ArticleLocale,\n ArticleSummary,\n EventPickem,\n EventOdds,\n FightInclude,\n FightOdds,\n OddsHistoryPoint,\n Compare,\n Matchup,\n WhosNext,\n EventStorylines,\n YearStats,\n EventWatch,\n OrgDivision,\n LeaderboardRow,\n RecordBookSection,\n StatScope,\n RightsSeries,\n SplitDecisionRow,\n ChangeFeedEntry,\n ChangeKind,\n FightSearchMethod,\n FightSearchRow,\n BroadcastRight,\n CareerBout,\n CareerStats,\n Champion,\n EventInclude,\n EventListInclude,\n JudgeScorecardRow,\n PowerIndexMover,\n PowerIndexRow,\n PowerIndexView,\n Envelope,\n EventChange,\n EventDetail,\n EventSummary,\n Fight,\n Fighter,\n FighterInclude,\n FighterSummary,\n Judge,\n Meta,\n Org,\n Plans,\n PowerIndex,\n RankingsBoard,\n RateLimit,\n Scorecards,\n Usage,\n Venue,\n WebhookEndpoint,\n} from './types';\n\nexport const DEFAULT_BASE_URL = 'https://api.ufcalendar.com/v1';\nconst DEFAULT_TIMEOUT_MS = 30_000;\n/** Default number of times a GET that hit the per-minute limit is retried. */\nexport const DEFAULT_MAX_RETRIES = 3;\n/**\n * A 429 whose `Retry-After` is longer than this is not waited out: the\n * per-minute limit always resets within a minute, anything longer is the\n * monthly quota (or something we do not understand) and must surface.\n */\nexport const MAX_RETRY_AFTER_SECONDS = 60;\nconst RETRY_JITTER_MS = 500;\n\nexport interface FightAPIOptions {\n /** `ufcalendar_…` key from https://www.ufcalendar.com/account/api. Falls back\n * to `UFCALENDAR_API_KEY` / `UFCAL_API_KEY` in the environment. Only\n * `plans()` works without one. */\n apiKey?: string;\n /** Override for testing; defaults to the production `/v1`. */\n baseUrl?: string;\n /** Inject a fetch (a test double, an instrumented fetch, undici). */\n fetch?: typeof fetch;\n /** Per-request timeout. Default 30s. */\n timeoutMs?: number;\n /** Extra headers on every request. */\n headers?: Record<string, string>;\n /**\n * How many times a GET that hit the per-minute limit (429 `rate_limited`\n * with `Retry-After` ≤ 60 s) is retried after waiting `Retry-After` plus a\n * little jitter. Default 3; `0` disables. The monthly quota\n * (`quota_exceeded`) and non-GET requests always throw at once.\n */\n maxRetries?: number;\n /** Replace the wait between rate-limit retries (tests, custom schedulers). */\n sleep?: (ms: number) => Promise<void>;\n}\n\n/** An error response from the Fight API. */\nexport class FightAPIError extends Error {\n readonly status: number;\n readonly code: string;\n readonly requestId: string | null;\n\n constructor(status: number, code: string, message: string, requestId: string | null = null) {\n super(`${status} ${code}: ${message}${requestId ? ` (request_id=${requestId})` : ''}`);\n this.name = 'FightAPIError';\n this.status = status;\n this.code = code;\n this.requestId = requestId;\n }\n}\n\nexport type QueryValue = string | number | boolean | null | undefined;\nexport type Query = Record<string, QueryValue>;\n\ninterface PageOptions {\n /** Stop after this many rows (across pages). */\n limit?: number;\n}\n\n/**\n * A browser forbids setting User-Agent on fetch, so we only set ours\n * off-browser. The test is `document`, NOT `navigator`: Node 21+ ships a\n * global `navigator`, so a navigator check would silently drop the header\n * on every modern Node runtime — which is the one place it works.\n */\nfunction canSetUserAgent(): boolean {\n return typeof document === 'undefined' && typeof window === 'undefined';\n}\n\n/** `Retry-After` as seconds: delta-seconds or an HTTP date; null if absent/unparseable. */\nfunction retryAfterSeconds(value: string | null): number | null {\n if (value === null) return null;\n const v = value.trim();\n if (v === '') return null;\n let secs = Number(v);\n if (!Number.isFinite(secs)) {\n const when = Date.parse(v);\n if (!Number.isFinite(when)) return null;\n secs = (when - Date.now()) / 1000;\n }\n return Math.max(0, secs);\n}\n\n/**\n * Seconds to wait before retrying a 429, or null when it must not be retried.\n * Only the per-minute limit (`rate_limited`) is waited out. The monthly quota\n * (`quota_exceeded`) throws at once — near the end of a month its\n * `Retry-After` can be short, so the code is checked, not just the header.\n */\nfunction shortRateLimitWait(res: Response, code: string | undefined): number | null {\n if (code === 'quota_exceeded') return null;\n const secs = retryAfterSeconds(res.headers.get('Retry-After'));\n if (secs === null || secs > MAX_RETRY_AFTER_SECONDS) return null;\n return secs;\n}\n\nconst defaultSleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));\n\nfunction envKey(): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env;\n return env?.UFCALENDAR_API_KEY || env?.UFCAL_API_KEY;\n}\n\nexport class FightAPI {\n readonly baseUrl: string;\n readonly apiKey: string | undefined;\n /** Retries of a GET that hit the per-minute limit (see `FightAPIOptions.maxRetries`). */\n readonly maxRetries: number;\n\n /** `meta` of the most recent response (pagination cursor, generated_at …). */\n lastMeta: Meta | null = null;\n /** `X-RateLimit-*` of the most recent response. */\n lastRateLimit: RateLimit = { limit: null, remaining: null, reset: null };\n\n readonly #fetch: typeof fetch;\n readonly #timeoutMs: number;\n readonly #headers: Record<string, string>;\n readonly #sleep: (ms: number) => Promise<void>;\n\n constructor(apiKeyOrOptions?: string | FightAPIOptions, options: FightAPIOptions = {}) {\n const opts: FightAPIOptions =\n typeof apiKeyOrOptions === 'string'\n ? { ...options, apiKey: apiKeyOrOptions }\n : { ...options, ...(apiKeyOrOptions ?? {}) };\n this.apiKey = opts.apiKey ?? envKey();\n this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, '');\n this.#fetch = opts.fetch ?? globalThis.fetch;\n this.#timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.#headers = opts.headers ?? {};\n this.#sleep = opts.sleep ?? defaultSleep;\n const maxRetries = opts.maxRetries ?? DEFAULT_MAX_RETRIES;\n if (!Number.isInteger(maxRetries) || maxRetries < 0) {\n throw new RangeError('maxRetries must be a non-negative integer');\n }\n this.maxRetries = maxRetries;\n if (!this.#fetch) {\n throw new Error('No global fetch available. Use Node 18+ or pass { fetch }.');\n }\n }\n\n /* ---------------------------------------------------------------- core */\n\n #url(path: string, params?: Query): string {\n const url = new URL(`${this.baseUrl}/${path.replace(/^\\/+/, '')}`);\n for (const [k, v] of Object.entries(params ?? {})) {\n if (v === undefined || v === null) continue;\n url.searchParams.set(k, String(v));\n }\n return url.toString();\n }\n\n async #request<T>(\n method: string,\n path: string,\n { params, body, open = false }: { params?: Query; body?: unknown; open?: boolean } = {},\n ): Promise<Envelope<T>> {\n if (!this.apiKey && !open) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (free plan: 100 requests/month, no card) live at https://www.ufcalendar.com/account/api',\n );\n }\n const headers: Record<string, string> = { Accept: 'application/json', ...this.#headers };\n if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;\n if (canSetUserAgent()) headers['User-Agent'] = `ufcalendar-typescript/${VERSION}`;\n if (body !== undefined) headers['Content-Type'] = 'application/json';\n\n const url = this.#url(path, params);\n let res: Response;\n let text: string;\n let parsed: unknown;\n for (let attempt = 0; ; attempt += 1) {\n try {\n res = await this.#fetch(url, {\n method,\n headers,\n body: body === undefined ? undefined : JSON.stringify(body),\n signal: AbortSignal.timeout(this.#timeoutMs),\n });\n } catch (e) {\n const err = e as { name?: string; message?: string };\n if (err?.name === 'TimeoutError') {\n throw new FightAPIError(0, 'timeout', `Request to ${path} timed out after ${this.#timeoutMs}ms`);\n }\n throw new FightAPIError(0, 'network_error', err?.message ?? String(e));\n }\n\n this.lastRateLimit = {\n limit: res.headers.get('X-RateLimit-Limit'),\n remaining: res.headers.get('X-RateLimit-Remaining'),\n reset: res.headers.get('X-RateLimit-Reset'),\n };\n\n if (res.status === 204) {\n this.lastMeta = null;\n return { data: undefined as T };\n }\n\n text = await res.text();\n parsed = undefined;\n try {\n parsed = text ? JSON.parse(text) : undefined;\n } catch {\n parsed = undefined;\n }\n\n // Wait out the per-minute limit on reads (a 429'd request is not\n // counted against the month). Writes are never replayed.\n if (res.status === 429 && method.toUpperCase() === 'GET' && attempt < this.maxRetries) {\n const code = (parsed as { error?: { code?: string } } | undefined)?.error?.code;\n const wait = shortRateLimitWait(res, code);\n if (wait !== null) {\n await this.#sleep(wait * 1000 + Math.random() * RETRY_JITTER_MS);\n continue;\n }\n }\n break;\n }\n\n if (!res.ok) {\n const err = (parsed as { error?: { code?: string; message?: string; request_id?: string } } | undefined)?.error;\n if (err) {\n throw new FightAPIError(\n res.status,\n String(err.code ?? 'error'),\n String(err.message ?? text.slice(0, 200)),\n err.request_id ?? res.headers.get('x-request-id'),\n );\n }\n throw new FightAPIError(res.status, 'http_error', text.slice(0, 200), res.headers.get('x-request-id'));\n }\n\n const env = (parsed ?? {}) as Envelope<T>;\n this.lastMeta = env.meta ?? null;\n return env;\n }\n\n /** Raw GET returning the `data` value. Escape hatch for new endpoints. */\n async get<T = unknown>(path: string, params?: Query): Promise<T> {\n return (await this.#request<T>('GET', path, { params })).data;\n }\n\n /** Raw GET returning the whole `{data, meta}` envelope. */\n async getWithMeta<T = unknown>(path: string, params?: Query): Promise<Envelope<T>> {\n return this.#request<T>('GET', path, { params });\n }\n\n async *#paginate<T>(path: string, params: Query, opts: PageOptions = {}): AsyncGenerator<T, void, void> {\n // Never fetch a bigger page than the caller wants rows: `limit: 3` used\n // to pull 100 rows and throw 97 away, burning the caller's quota on a\n // request they did not ask for (and, on a trial key, a noticeable slice\n // of the 100 they get).\n const pageSize = Math.min(100, opts.limit ?? 100);\n const query: Query = { limit: pageSize, ...params };\n let seen = 0;\n for (;;) {\n const env = await this.#request<T[]>('GET', path, { params: query });\n for (const row of env.data ?? []) {\n yield row;\n seen += 1;\n if (opts.limit !== undefined && seen >= opts.limit) return;\n }\n const cursor = env.meta?.pagination?.next_cursor;\n if (!cursor) return;\n query.cursor = cursor;\n }\n }\n\n /* --------------------------------------------------------------- plans */\n\n /**\n * Plans (Free first), quotas, the free-plan rule, the MCP endpoint and the doc\n * links. The only endpoint that answers without a credential.\n */\n async plans(): Promise<Plans> {\n return (await this.#request<Plans>('GET', 'plans', { open: true })).data;\n }\n\n /* ---------------------------------------------------------------- orgs */\n\n /** Launch orgs with capability flags (stats / rounds / rankings / broadcasts / predictions / scorecards / odds). */\n orgs(): Promise<Org[]> {\n return this.get<Org[]>('orgs');\n }\n\n org(slug: string): Promise<Org> {\n return this.get<Org>(`orgs/${encodeURIComponent(slug)}`);\n }\n\n /**\n * One weight class in one promotion: its rankings board (null where the\n * promotion publishes none), upcoming bouts at that weight, the latest\n * results and the roster by recency. `division` is a slug, e.g.\n * `lightweight` or `womens-strawweight`.\n */\n orgDivision(org: string, division: string): Promise<OrgDivision> {\n return this.get<OrgDivision>(`orgs/${encodeURIComponent(org)}/divisions/${encodeURIComponent(division)}`);\n }\n\n /* -------------------------------------------------------------- events */\n\n /**\n * Schedule + results. Bare call = the upcoming calendar, soonest first.\n * `status: 'completed'` (or `order: 'desc'`) browses the archive\n * newest-first; `status: 'upcoming'` = every card not yet over (announced,\n * scheduled or live). `from` / `to` are `YYYY-MM-DD`.\n */\n events(\n opts: {\n org?: string;\n status?: string;\n from?: string;\n to?: string;\n order?: 'asc' | 'desc';\n /** Only cards with (true) / without (false) a title bout. */\n isTitleCard?: boolean;\n /** Only PPV (true) / non-PPV (false) cards. */\n isPpv?: boolean;\n /** `headline` adds each card's main event. */\n include?: EventListInclude[];\n limit?: number;\n } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, isTitleCard, isPpv, include, ...params } = opts;\n return this.#paginate<EventSummary>('events', {\n ...params,\n is_title_card: isTitleCard,\n is_ppv: isPpv,\n include: include?.length ? include.join(',') : undefined,\n } as Query, { limit });\n }\n\n /**\n * One event with its full fight card, venue and broadcasts.\n * `include: ['eta']` adds an estimated start time to every bout;\n * `include: ['odds']` adds each bout's current consensus line (the closing line once settled) (null when\n * unpriced). Pass both as `['eta', 'odds']`.\n */\n event(idOrSlug: string | number, opts: { include?: EventInclude[] } = {}): Promise<EventDetail> {\n return this.get<EventDetail>(\n `events/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * Who airs one event, per country: the promotion's rights deals for the\n * event's series merged with the event's own listings. `country` (ISO-2)\n * narrows to that market plus worldwide.\n */\n eventWatch(idOrSlug: string | number, opts: { country?: string } = {}): Promise<EventWatch> {\n return this.get<EventWatch>(`events/${encodeURIComponent(String(idOrSlug))}/watch`, opts as Query);\n }\n\n /**\n * The talking points of one card as of its start: title fights and\n * eliminators, the closest bout (UFCalendar model, else Power Index — not\n * betting advice), rematches and trilogy deciders, streaks, debuts and\n * returns, ranked fighters, nations, tallest / longest reach, the fastest\n * career finish.\n */\n eventStorylines(idOrSlug: string | number): Promise<EventStorylines> {\n return this.get<EventStorylines>(`events/${encodeURIComponent(String(idOrSlug))}/storylines`);\n }\n\n /**\n * How the UFCalendar community is picking each bout on one card: picks per\n * corner, the total and `pct_a`, in card order. Crowd sentiment from our\n * own pick'em game, not a market and not a forecast.\n */\n eventPickem(idOrSlug: string | number): Promise<EventPickem> {\n return this.get<EventPickem>(`events/${encodeURIComponent(String(idOrSlug))}/pickem`);\n }\n\n /**\n * The UFCalendar consensus odds for every non-cancelled bout on one card, in\n * card order: `consensus`, `opening`, `closing` (settled bouts), `movement`\n * and `points`. Unpriced bouts stay on the list with nulls and `points: 0`;\n * `lastMeta.priced` / `lastMeta.unpriced` count both. Information only, not\n * betting advice.\n */\n eventOdds(idOrSlug: string | number): Promise<EventOdds> {\n return this.get<EventOdds>(`events/${encodeURIComponent(String(idOrSlug))}/odds`);\n }\n\n /** Card-change diff log (fight added/removed, opponent swapped, date moved, profile merged). */\n eventChanges(idOrSlug: string | number): Promise<EventChange[]> {\n return this.get<EventChange[]>(`events/${encodeURIComponent(String(idOrSlug))}/changes`);\n }\n\n /**\n * The card-change feed across every event, newest first (default: the last\n * 90 days) — the `card.changed` webhook's audit trail, for callers that\n * poll. `since` is `YYYY-MM-DD` or an ISO-8601 datetime.\n */\n changes(\n opts: { org?: string; since?: string; kind?: ChangeKind; limit?: number } = {},\n ): AsyncGenerator<ChangeFeedEntry, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ChangeFeedEntry>('changes', params as Query, { limit });\n }\n\n /* -------------------------------------------------------------- fights */\n\n /** One bout with its result. `include: ['odds']` adds the current consensus line (the closing line once the bout is settled). */\n fight(fightId: number | string, opts: { include?: FightInclude[] } = {}): Promise<Fight> {\n return this.get<Fight>(\n `fights/${encodeURIComponent(String(fightId))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * The UFCalendar consensus line for one bout: `consensus` (latest point; the closing line once settled),\n * `opening`, `closing` (the last point at or before the event start,\n * settled bouts only), `movement` (opening → consensus in implied-probability\n * points on corner a) and `sources` on every point (how many sportsbooks\n * backed it; book identities are never exposed). An unpriced bout resolves\n * with null blocks and `points: 0`. Information only, not betting advice.\n */\n fightOdds(fightId: number | string): Promise<FightOdds> {\n return this.get<FightOdds>(`fights/${encodeURIComponent(String(fightId))}/odds`);\n }\n\n /**\n * Every consensus point for one bout, oldest first (Pro plans and up; a\n * lower plan throws `FightAPIError` 403 `tier_required`). A point is stored\n * only when the consensus moves. `from` / `to` are inclusive `YYYY-MM-DD`.\n */\n fightOddsHistory(\n fightId: number | string,\n opts: { from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<OddsHistoryPoint, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<OddsHistoryPoint>(\n `fights/${encodeURIComponent(String(fightId))}/odds/history`,\n params as Query,\n { limit },\n );\n }\n\n /**\n * Per-fight totals for both corners, each with `fantasy` — UFCalendar\n * fantasy points with a per-category breakdown and `complete`. The\n * data-quality flags ride in `lastMeta.quality` (`StatsQuality`).\n */\n fightStats(fightId: number | string): Promise<FightStatLine[]> {\n return this.get<FightStatLine[]>(`fights/${encodeURIComponent(String(fightId))}/stats`);\n }\n\n /** Round-by-round stat lines for both corners. */\n fightRounds(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/rounds`);\n }\n\n /**\n * The judges' scorecards for a bout — the official commission record:\n * decision type, point deductions, and one card per judge with every\n * round, the totals and `winner_fighter_id`. Scores are oriented to\n * `fighter_a_id` / `fighter_b_id`, both repeated on the payload.\n *\n * Check `scores_known` on a card before charting totals: when it is false\n * the commission published only the outcome. Throws 404 for a bout that\n * did not go to the judges.\n */\n fightScorecards(fightId: number | string): Promise<Scorecards> {\n return this.get<Scorecards>(`fights/${encodeURIComponent(String(fightId))}/scorecards`);\n }\n\n /**\n * Completed bouts, filtered — newest first unless `order: 'oldest'`. At\n * least one narrowing filter is required (`titleOnly`, `method`,\n * `division`, `fighter`, `winner`, `from`, `to`, `mainEventsOnly`); the\n * server serves 25 rows a page and at most 10 pages.\n */\n findFights(\n opts: {\n org?: string;\n titleOnly?: boolean;\n method?: FightSearchMethod;\n /** Division slug (`lightweight`) or a name fragment. */\n division?: string;\n /** Fighter slug or id — bouts they were in. */\n fighter?: string | number;\n /** Fighter slug or id — bouts they won. */\n winner?: string | number;\n from?: string;\n to?: string;\n mainEventsOnly?: boolean;\n order?: 'newest' | 'oldest';\n limit?: number;\n } = {},\n ): AsyncGenerator<FightSearchRow, void, void> {\n const { limit, titleOnly, mainEventsOnly, fighter, winner, ...rest } = opts;\n return this.#paginate<FightSearchRow>('fights/search', {\n ...rest,\n title_only: titleOnly,\n main_events_only: mainEventsOnly,\n fighter: fighter === undefined ? undefined : String(fighter),\n winner: winner === undefined ? undefined : String(winner),\n } as Query, { limit });\n }\n\n /* -------------------------------------------------------------- judges */\n\n /**\n * Every official who has scored a launch-org bout, busiest first. Rates\n * mean little below ~10 fights; pass `minFights: 10`.\n */\n judges(\n opts: { q?: string; org?: string; minFights?: number; limit?: number } = {},\n ): AsyncGenerator<Judge, void, void> {\n const { limit, minFights, ...rest } = opts;\n return this.#paginate<Judge>('judges', { ...rest, min_fights: minFights } as Query, { limit });\n }\n\n judge(judgeId: number | string): Promise<Judge> {\n return this.get<Judge>(`judges/${encodeURIComponent(String(judgeId))}`);\n }\n\n /**\n * Split and majority decisions, newest first, with every judge's card and\n * the dissenting judges named. Commission records only.\n */\n splitDecisions(\n opts: { org?: string; from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<SplitDecisionRow, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<SplitDecisionRow>('scorecards/splits', params as Query, { limit });\n }\n\n /**\n * Every card this judge has turned in, newest first, with `lone_dissent`,\n * `split` and the `colleagues`' totals on each row.\n */\n judgeScorecards(\n judgeId: number | string,\n opts: { limit?: number } = {},\n ): AsyncGenerator<JudgeScorecardRow, void, void> {\n return this.#paginate<JudgeScorecardRow>(\n `judges/${encodeURIComponent(String(judgeId))}/scorecards`,\n {},\n opts,\n );\n }\n\n /* ------------------------------------------------------------ referees */\n\n /**\n * Every referee who has worked a settled launch-org bout, busiest first:\n * bouts, promotions, finish rate, method mix and average fight time. The\n * id is a slug of the name; `q` is accent- and spacing-insensitive.\n */\n referees(opts: { q?: string; org?: string; limit?: number } = {}): AsyncGenerator<Referee, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<Referee>('referees', params as Query, { limit });\n }\n\n /** One referee's career aggregates, e.g. `referee('herb-dean')`. */\n referee(slug: string): Promise<Referee> {\n return this.get<Referee>(`referees/${encodeURIComponent(slug)}`);\n }\n\n /** Every settled bout one referee worked, newest first (the bout plus its `event`). */\n refereeFights(slug: string, opts: { limit?: number } = {}): AsyncGenerator<RefereeFightRow, void, void> {\n return this.#paginate<RefereeFightRow>(`referees/${encodeURIComponent(slug)}/fights`, {}, opts);\n }\n\n /* ------------------------------------------------------------ coverage */\n\n /**\n * What the database holds per launch org per year: events, settled bouts\n * and how many carry stats, round stats, commission scorecards and a\n * consensus odds line, with `totals` and `last_result_at`.\n */\n coverage(opts: { org?: string } = {}): Promise<OrgCoverage[]> {\n return this.get<OrgCoverage[]>('coverage', opts.org ? { org: opts.org } : undefined);\n }\n\n /* ------------------------------------------------------------ fighters */\n\n fighters(\n opts: { q?: string; org?: string; country?: string; limit?: number } = {},\n ): AsyncGenerator<FighterSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<FighterSummary>('fighters', params as Query, { limit });\n }\n\n /**\n * Bio, records, career stats, Power Index, CC-licensed images, `next_fight`\n * and `last_fight`. `include: ['bonuses']` adds the UFC bonus ledger;\n * `include: ['credentials']` adds grappling and wrestling pedigree, gyms and\n * coaches (every row with `sources` and a `confidence` grade).\n */\n fighter(idOrSlug: string | number, opts: { include?: FighterInclude[] } = {}): Promise<Fighter> {\n return this.get<Fighter>(\n `fighters/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /** Complete multi-promotion career timeline. */\n fighterHistory(idOrSlug: string | number): Promise<CareerBout[]> {\n return this.get<CareerBout[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/history`);\n }\n\n /** Raw career stat rows, one source-stamped row per scope (`pro-mma`, `ufc-only` …).\n * For the readable split use `fighter().records` / `fighter().stats`. */\n fighterStats(idOrSlug: string | number): Promise<CareerStats[]> {\n return this.get<CareerStats[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/stats`);\n }\n\n /** Every ranking row the fighter ever held, newest first, across every board\n * (`board` is `official` / `meta`; `is_champion` when rank 0). The endpoint is\n * cursor-paginated since 2026-09-24 — this walks every page so the array is\n * complete (a long career is 900+ rows). */\n async fighterRankings(idOrSlug: string | number): Promise<Record<string, unknown>[]> {\n const out: Record<string, unknown>[] = [];\n for await (const row of this.#paginate<Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/rankings`, { limit: 500 } as Query)) out.push(row);\n return out;\n }\n\n fighterPowerIndex(idOrSlug: string | number): Promise<PowerIndex & Record<string, unknown>> {\n return this.get<PowerIndex & Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/power-index`,\n );\n }\n\n /**\n * Two fighters side by side (slugs or ids): bios with age, career stats,\n * strike mix, win streaks, previous meetings, common opponents, the booked\n * bout between them, the UFCalendar model prediction for it (UFC; not\n * betting advice) and Power Index ratings.\n */\n compare(a: string | number, b: string | number): Promise<Compare> {\n return this.get<Compare>('compare', { a: String(a), b: String(b) });\n }\n\n /* ------------------------------------------------------------ rankings */\n\n /**\n * Official board, point-in-time. `date: 'YYYY-MM-DD'` returns the board\n * that was valid on that day (UFC history back to 2013; rank 0 = champion).\n */\n rankings(org = 'ufc', opts: { date?: string; board?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(`rankings/${encodeURIComponent(org)}`, opts as Query);\n }\n\n divisionRankings(org: string, division: string, opts: { date?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(\n `rankings/${encodeURIComponent(org)}/${encodeURIComponent(division)}`,\n opts as Query,\n );\n }\n\n /** Current champions across every launch org, or one `org` / `division`. */\n champions(opts: { org?: string; division?: string } = {}): Promise<Champion[]> {\n return this.get<Champion[]>('champions', opts);\n }\n\n /**\n * UFCalendar Power Index board. `view: 'movers'` = biggest risers over\n * `days` (default 365), `view: 'peaks'` = all-time peak ratings;\n * `division` narrows any view.\n */\n powerIndex(\n org = 'ufc',\n opts: { view?: PowerIndexView; division?: string; days?: number; limit?: number } = {},\n ): Promise<(PowerIndexRow | PowerIndexMover)[]> {\n return this.get<(PowerIndexRow | PowerIndexMover)[]>(`power-index/${encodeURIComponent(org)}`, {\n view: opts.view,\n division: opts.division,\n days: opts.days,\n limit: opts.limit,\n });\n }\n\n /* ---------------------------------------------------------- matchmaker */\n\n /**\n * UFCalendar's matchmaker: the fights worth making in one MMA promotion,\n * scored 0–100, across the roster or for one `division` (`lastMeta.divisions`\n * lists the valid ones). Not a list of bookings; computed without the\n * site's Fight DNA factor.\n */\n matchmaker(org = 'ufc', opts: { division?: string; limit?: number } = {}): Promise<Matchup[]> {\n return this.get<Matchup[]>(`matchmaker/${encodeURIComponent(org)}`, {\n division: opts.division,\n limit: opts.limit,\n });\n }\n\n /**\n * Who one fighter (slug or id) should fight next: the best-scored\n * opponents with the Power Index win probability for each, plus the bout\n * already booked (`booked_next`).\n */\n whosNext(fighter: string | number, opts: { limit?: number } = {}): Promise<WhosNext> {\n return this.get<WhosNext>(`matchmaker/next/${encodeURIComponent(String(fighter))}`, { limit: opts.limit });\n }\n\n /* --------------------------------------------------------------- stats */\n\n /**\n * One Record Book leaderboard for one promotion (`metric` e.g. `wins`,\n * `fastest_knockout`, `finish_rate`). Narrow with `division` (slug),\n * `country` (ISO-2) or `population: 'active'` — not `country` and\n * `active` together. `lastMeta.metric` names the unit and what\n * `value_secondary` means.\n */\n leaderboard(\n org: string,\n metric: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; limit?: number } = {},\n ): Promise<LeaderboardRow[]> {\n return this.get<LeaderboardRow[]>('stats/leaders', { org, metric, ...opts } as Query);\n }\n\n /**\n * Every leaderboard's top rows (`top`, default 10, max 25) for one\n * promotion, grouped by category.\n */\n recordBook(\n org: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; scope?: StatScope; top?: number } = {},\n ): Promise<RecordBookSection[]> {\n return this.get<RecordBookSection[]>('stats/record-book', { org, ...opts } as Query);\n }\n\n /**\n * One calendar year in numbers for one promotion, or every covered\n * promotion when `org` is omitted: events, title fights, finish methods,\n * divisions, fastest finishes, upsets, Power Index climbers, busiest\n * fighters, host countries and the most-used judges.\n */\n yearStats(year: number, opts: { org?: string } = {}): Promise<YearStats> {\n return this.get<YearStats>(`stats/years/${encodeURIComponent(String(year))}`, opts as Query);\n }\n\n /* ---------------------------------------------------------------- misc */\n\n /** Model win probabilities for upcoming UFC bouts; `event` narrows to one card. */\n predictionsUpcoming(opts: { event?: string | number } = {}): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(\n 'predictions/upcoming',\n opts.event !== undefined ? { event: String(opts.event) } : undefined,\n );\n }\n\n /**\n * Who airs the promotion, per ISO-2 country — the org-wide deals, or a UFC\n * sub-series grid with `series: 'dwcs' | 'rtufc'`.\n */\n broadcastRights(org = 'ufc', opts: { country?: string; series?: RightsSeries } = {}): Promise<BroadcastRight[]> {\n return this.get<BroadcastRight[]>(`broadcast-rights/${encodeURIComponent(org)}`, opts as Query);\n }\n\n /**\n * Venues that hosted a covered promotion, alphabetical. `q` (2+ chars)\n * matches name or city; `country` is an ISO-2 code or an English name.\n */\n venues(opts: { q?: string; country?: string; limit?: number } = {}): AsyncGenerator<Venue, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<Venue>('venues', params as Query, { limit });\n }\n\n venue(venueId: number | string): Promise<Venue> {\n return this.get<Venue>(`venues/${encodeURIComponent(String(venueId))}`);\n }\n\n /** Every covered event at one venue, newest first (`order: 'asc'` reverses). */\n venueEvents(\n venueId: number | string,\n opts: { status?: string; from?: string; to?: string; order?: 'asc' | 'desc'; limit?: number } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<EventSummary>(`venues/${encodeURIComponent(String(venueId))}/events`, params as Query, { limit });\n }\n\n /** Typeahead across fighters and events. */\n search(q: string): Promise<Record<string, unknown>> {\n return this.get<Record<string, unknown>>('search', { q });\n }\n\n /**\n * UFCalendar's own editorial archive, newest first. `q` (2+ chars) matches\n * title, summary or a tag; `tag` is exact; `locale` is one of the 13 site\n * languages (English fallback).\n */\n articles(\n opts: { q?: string; tag?: string; locale?: ArticleLocale; limit?: number } = {},\n ): AsyncGenerator<ArticleSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ArticleSummary>('articles', params as Query, { limit });\n }\n\n /**\n * One article: full Markdown `body_md` (client widgets removed), author,\n * tags, `published_at`; `served_locale` names the language\n * delivered.\n */\n article(slug: string, opts: { locale?: ArticleLocale } = {}): Promise<Article> {\n return this.get<Article>(`articles/${encodeURIComponent(slug)}`, opts as Query);\n }\n\n /** Your key's month-to-date quota usage. */\n usage(): Promise<Usage> {\n return this.get<Usage>('usage');\n }\n\n /**\n * Subscribable ICS feed URL for calendar apps (authenticates via `?key=`).\n *\n * Throws without a key rather than returning `?key=`: that empty URL is\n * pasted into a calendar app, fails there hours later, and the failure\n * surfaces nowhere near this call.\n */\n calendarIcsUrl(org = 'ufc'): string {\n if (!this.apiKey) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (free plan: 100 requests/month, no card) live at https://www.ufcalendar.com/account/api',\n );\n }\n return `${this.baseUrl}/calendar/${encodeURIComponent(org)}.ics?key=${encodeURIComponent(this.apiKey)}`;\n }\n\n /* ------------------------------------------------------------ webhooks */\n\n webhookEndpoints(): Promise<WebhookEndpoint[]> {\n return this.get<WebhookEndpoint[]>('webhook-endpoints');\n }\n\n /**\n * Register a signed webhook (Pro and up). `events` ⊆ `event.announced`,\n * `fight.result`, `card.changed`, `event.completed`, `odds.moved` (the\n * consensus line on an upcoming bout moved 5+ implied-probability points or\n * the favourite flipped). The signing secret is returned ONCE, in this\n * response.\n */\n async createWebhookEndpoint(url: string, events?: string[]): Promise<WebhookEndpoint> {\n const body: Record<string, unknown> = { url };\n if (events?.length) body.events = events;\n return (await this.#request<WebhookEndpoint>('POST', 'webhook-endpoints', { body })).data;\n }\n\n async deleteWebhookEndpoint(endpointId: number | string): Promise<void> {\n await this.#request<unknown>('DELETE', `webhook-endpoints/${encodeURIComponent(String(endpointId))}`);\n }\n\n async rotateWebhookSecret(endpointId: number | string): Promise<WebhookEndpoint> {\n return (\n await this.#request<WebhookEndpoint>(\n 'POST',\n `webhook-endpoints/${encodeURIComponent(String(endpointId))}/rotate-secret`,\n )\n ).data;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,UAAU;;;AC+EhB,IAAM,mBAAmB;AAChC,IAAM,qBAAqB;AAEpB,IAAM,sBAAsB;AAM5B,IAAM,0BAA0B;AACvC,IAAM,kBAAkB;AA2BjB,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,MAAc,SAAiB,YAA2B,MAAM;AAC1F,UAAM,GAAG,MAAM,IAAI,IAAI,KAAK,OAAO,GAAG,YAAY,gBAAgB,SAAS,MAAM,EAAE,EAAE;AACrF,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,YAAY;AAAA,EACnB;AACF;AAgBA,SAAS,kBAA2B;AAClC,SAAO,OAAO,aAAa,eAAe,OAAO,WAAW;AAC9D;AAGA,SAAS,kBAAkB,OAAqC;AAC9D,MAAI,UAAU,KAAM,QAAO;AAC3B,QAAM,IAAI,MAAM,KAAK;AACrB,MAAI,MAAM,GAAI,QAAO;AACrB,MAAI,OAAO,OAAO,CAAC;AACnB,MAAI,CAAC,OAAO,SAAS,IAAI,GAAG;AAC1B,UAAM,OAAO,KAAK,MAAM,CAAC;AACzB,QAAI,CAAC,OAAO,SAAS,IAAI,EAAG,QAAO;AACnC,YAAQ,OAAO,KAAK,IAAI,KAAK;AAAA,EAC/B;AACA,SAAO,KAAK,IAAI,GAAG,IAAI;AACzB;AAQA,SAAS,mBAAmB,KAAe,MAAyC;AAClF,MAAI,SA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AI,QAAQ,OAAQ,MAAK,SAAS;AAClC,YAAQ,MAAM,KAAK,SAA0B,QAAQ,qBAAqB,EAAE,KAAK,CAAC,GAAG;AAAA,EACvF;AAAA,EAEA,MAAM,sBAAsB,YAA4C;AACtE,UAAM,KAAK,SAAkB,UAAU,qBAAqB,mBAAmB,OAAO,UAAU,CAAC,CAAC,EAAE;AAAA,EACtG;AAAA,EAEA,MAAM,oBAAoB,YAAuD;AAC/E,YACE,MAAM,KAAK;AAAA,MACT;AAAA,MACA,qBAAqB,mBAAmB,OAAO,UAAU,CAAC,CAAC;AAAA,IAC7D,GACA;AAAA,EACJ;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/version.ts","../src/client.ts"],"sourcesContent":["export { FightAPI, FightAPIError, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, MAX_RETRY_AFTER_SECONDS } from './client';\nexport type { FightAPIOptions, Query, QueryValue } from './client';\nexport { VERSION } from './version';\nexport type * from './types';\n/** The generated OpenAPI path map, for anything the hand-written types above\n * do not cover. Regenerated by `pnpm gen:types` from apps/api/openapi.json. */\nexport type { paths, operations } from './schema';\n","/** Kept in lockstep with package.json and the User-Agent by\n * `apps/api/src/surfaces.test.ts`. Bump all three together. */\nexport const VERSION = '0.10.0';\n","/**\n * Thin, dependency-free client for https://api.ufcalendar.com/v1.\n *\n * Every method returns the parsed `data` value of the JSON envelope\n * (`{\"data\": ..., \"meta\": ...}`); list endpoints are async generators that\n * follow cursor pagination for you. Errors throw `FightAPIError` carrying\n * the API's `code`, `message` and `requestId` — quote the request id when\n * you write to api@ufcalendar.com.\n *\n * Mirrors sdk/python/ufcalendar/client.py one method per endpoint, in\n * camelCase. The two clients are kept in lockstep by\n * `apps/api/src/surfaces.test.ts`.\n *\n * Odds are the UFCalendar consensus line: one anonymised line per corner\n * across the sportsbooks we track (`sources` = how many books backed each\n * point; book identities are never exposed). Information only, not betting\n * advice. Fighter `images` are Wikimedia\n * Commons / Creative Commons files — the `license` and `artist` fields you\n * receive must be displayed as a credit.\n */\nimport { VERSION } from './version';\nimport type {\n Article,\n FightPositions,\n FightStatLine,\n FightTimeline,\n FighterDiscipline,\n FighterPositions,\n OrgCoverage,\n Referee,\n RefereeFightRow,\n ArticleLocale,\n ArticleSummary,\n EventPickem,\n EventOdds,\n FightInclude,\n FightOdds,\n OddsHistoryPoint,\n Compare,\n Matchup,\n WhosNext,\n EventStorylines,\n YearStats,\n EventWatch,\n OrgDivision,\n LeaderboardRow,\n RecordBookSection,\n StatScope,\n RightsSeries,\n SplitDecisionRow,\n ChangeFeedEntry,\n ChangeKind,\n FightSearchMethod,\n FightSearchRow,\n BroadcastRight,\n CareerBout,\n CareerStats,\n Champion,\n EventInclude,\n EventListInclude,\n JudgeScorecardRow,\n PowerIndexMover,\n PowerIndexRow,\n PowerIndexView,\n Envelope,\n EventChange,\n EventDetail,\n EventSummary,\n Fight,\n Fighter,\n FighterInclude,\n FighterSummary,\n Judge,\n Meta,\n Org,\n Plans,\n PowerIndex,\n RankingsBoard,\n RateLimit,\n Scorecards,\n Usage,\n Venue,\n WebhookEndpoint,\n} from './types';\n\nexport const DEFAULT_BASE_URL = 'https://api.ufcalendar.com/v1';\nconst DEFAULT_TIMEOUT_MS = 30_000;\n/** Default number of times a GET that hit the per-minute limit is retried. */\nexport const DEFAULT_MAX_RETRIES = 3;\n/**\n * A 429 whose `Retry-After` is longer than this is not waited out: the\n * per-minute limit always resets within a minute, anything longer is the\n * monthly quota (or something we do not understand) and must surface.\n */\nexport const MAX_RETRY_AFTER_SECONDS = 60;\nconst RETRY_JITTER_MS = 500;\n\nexport interface FightAPIOptions {\n /** `ufcalendar_…` key from https://www.ufcalendar.com/account/api. Falls back\n * to `UFCALENDAR_API_KEY` / `UFCAL_API_KEY` in the environment. Only\n * `plans()` works without one. */\n apiKey?: string;\n /** Override for testing; defaults to the production `/v1`. */\n baseUrl?: string;\n /** Inject a fetch (a test double, an instrumented fetch, undici). */\n fetch?: typeof fetch;\n /** Per-request timeout. Default 30s. */\n timeoutMs?: number;\n /** Extra headers on every request. */\n headers?: Record<string, string>;\n /**\n * How many times a GET that hit the per-minute limit (429 `rate_limited`\n * with `Retry-After` ≤ 60 s) is retried after waiting `Retry-After` plus a\n * little jitter. Default 3; `0` disables. The monthly quota\n * (`quota_exceeded`) and non-GET requests always throw at once.\n */\n maxRetries?: number;\n /** Replace the wait between rate-limit retries (tests, custom schedulers). */\n sleep?: (ms: number) => Promise<void>;\n}\n\n/** An error response from the Fight API. */\nexport class FightAPIError extends Error {\n readonly status: number;\n readonly code: string;\n readonly requestId: string | null;\n\n constructor(status: number, code: string, message: string, requestId: string | null = null) {\n super(`${status} ${code}: ${message}${requestId ? ` (request_id=${requestId})` : ''}`);\n this.name = 'FightAPIError';\n this.status = status;\n this.code = code;\n this.requestId = requestId;\n }\n}\n\nexport type QueryValue = string | number | boolean | null | undefined;\nexport type Query = Record<string, QueryValue>;\n\ninterface PageOptions {\n /** Stop after this many rows (across pages). */\n limit?: number;\n}\n\n/**\n * A browser forbids setting User-Agent on fetch, so we only set ours\n * off-browser. The test is `document`, NOT `navigator`: Node 21+ ships a\n * global `navigator`, so a navigator check would silently drop the header\n * on every modern Node runtime — which is the one place it works.\n */\nfunction canSetUserAgent(): boolean {\n return typeof document === 'undefined' && typeof window === 'undefined';\n}\n\n/** `Retry-After` as seconds: delta-seconds or an HTTP date; null if absent/unparseable. */\nfunction retryAfterSeconds(value: string | null): number | null {\n if (value === null) return null;\n const v = value.trim();\n if (v === '') return null;\n let secs = Number(v);\n if (!Number.isFinite(secs)) {\n const when = Date.parse(v);\n if (!Number.isFinite(when)) return null;\n secs = (when - Date.now()) / 1000;\n }\n return Math.max(0, secs);\n}\n\n/**\n * Seconds to wait before retrying a 429, or null when it must not be retried.\n * Only the per-minute limit (`rate_limited`) is waited out. The monthly quota\n * (`quota_exceeded`) throws at once — near the end of a month its\n * `Retry-After` can be short, so the code is checked, not just the header.\n */\nfunction shortRateLimitWait(res: Response, code: string | undefined): number | null {\n if (code === 'quota_exceeded') return null;\n const secs = retryAfterSeconds(res.headers.get('Retry-After'));\n if (secs === null || secs > MAX_RETRY_AFTER_SECONDS) return null;\n return secs;\n}\n\nconst defaultSleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));\n\nfunction envKey(): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env;\n return env?.UFCALENDAR_API_KEY || env?.UFCAL_API_KEY;\n}\n\nexport class FightAPI {\n readonly baseUrl: string;\n readonly apiKey: string | undefined;\n /** Retries of a GET that hit the per-minute limit (see `FightAPIOptions.maxRetries`). */\n readonly maxRetries: number;\n\n /** `meta` of the most recent response (pagination cursor, generated_at …). */\n lastMeta: Meta | null = null;\n /** `X-RateLimit-*` of the most recent response. */\n lastRateLimit: RateLimit = { limit: null, remaining: null, reset: null };\n\n readonly #fetch: typeof fetch;\n readonly #timeoutMs: number;\n readonly #headers: Record<string, string>;\n readonly #sleep: (ms: number) => Promise<void>;\n\n constructor(apiKeyOrOptions?: string | FightAPIOptions, options: FightAPIOptions = {}) {\n const opts: FightAPIOptions =\n typeof apiKeyOrOptions === 'string'\n ? { ...options, apiKey: apiKeyOrOptions }\n : { ...options, ...(apiKeyOrOptions ?? {}) };\n this.apiKey = opts.apiKey ?? envKey();\n this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, '');\n this.#fetch = opts.fetch ?? globalThis.fetch;\n this.#timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.#headers = opts.headers ?? {};\n this.#sleep = opts.sleep ?? defaultSleep;\n const maxRetries = opts.maxRetries ?? DEFAULT_MAX_RETRIES;\n if (!Number.isInteger(maxRetries) || maxRetries < 0) {\n throw new RangeError('maxRetries must be a non-negative integer');\n }\n this.maxRetries = maxRetries;\n if (!this.#fetch) {\n throw new Error('No global fetch available. Use Node 18+ or pass { fetch }.');\n }\n }\n\n /* ---------------------------------------------------------------- core */\n\n #url(path: string, params?: Query): string {\n const url = new URL(`${this.baseUrl}/${path.replace(/^\\/+/, '')}`);\n for (const [k, v] of Object.entries(params ?? {})) {\n if (v === undefined || v === null) continue;\n url.searchParams.set(k, String(v));\n }\n return url.toString();\n }\n\n async #request<T>(\n method: string,\n path: string,\n { params, body, open = false }: { params?: Query; body?: unknown; open?: boolean } = {},\n ): Promise<Envelope<T>> {\n if (!this.apiKey && !open) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (free plan: 100 requests/month, no card) live at https://www.ufcalendar.com/account/api',\n );\n }\n const headers: Record<string, string> = { Accept: 'application/json', ...this.#headers };\n if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;\n if (canSetUserAgent()) headers['User-Agent'] = `ufcalendar-typescript/${VERSION}`;\n if (body !== undefined) headers['Content-Type'] = 'application/json';\n\n const url = this.#url(path, params);\n let res: Response;\n let text: string;\n let parsed: unknown;\n for (let attempt = 0; ; attempt += 1) {\n try {\n res = await this.#fetch(url, {\n method,\n headers,\n body: body === undefined ? undefined : JSON.stringify(body),\n signal: AbortSignal.timeout(this.#timeoutMs),\n });\n } catch (e) {\n const err = e as { name?: string; message?: string };\n if (err?.name === 'TimeoutError') {\n throw new FightAPIError(0, 'timeout', `Request to ${path} timed out after ${this.#timeoutMs}ms`);\n }\n throw new FightAPIError(0, 'network_error', err?.message ?? String(e));\n }\n\n this.lastRateLimit = {\n limit: res.headers.get('X-RateLimit-Limit'),\n remaining: res.headers.get('X-RateLimit-Remaining'),\n reset: res.headers.get('X-RateLimit-Reset'),\n };\n\n if (res.status === 204) {\n this.lastMeta = null;\n return { data: undefined as T };\n }\n\n text = await res.text();\n parsed = undefined;\n try {\n parsed = text ? JSON.parse(text) : undefined;\n } catch {\n parsed = undefined;\n }\n\n // Wait out the per-minute limit on reads (a 429'd request is not\n // counted against the month). Writes are never replayed.\n if (res.status === 429 && method.toUpperCase() === 'GET' && attempt < this.maxRetries) {\n const code = (parsed as { error?: { code?: string } } | undefined)?.error?.code;\n const wait = shortRateLimitWait(res, code);\n if (wait !== null) {\n await this.#sleep(wait * 1000 + Math.random() * RETRY_JITTER_MS);\n continue;\n }\n }\n break;\n }\n\n if (!res.ok) {\n const err = (parsed as { error?: { code?: string; message?: string; request_id?: string } } | undefined)?.error;\n if (err) {\n throw new FightAPIError(\n res.status,\n String(err.code ?? 'error'),\n String(err.message ?? text.slice(0, 200)),\n err.request_id ?? res.headers.get('x-request-id'),\n );\n }\n throw new FightAPIError(res.status, 'http_error', text.slice(0, 200), res.headers.get('x-request-id'));\n }\n\n const env = (parsed ?? {}) as Envelope<T>;\n this.lastMeta = env.meta ?? null;\n return env;\n }\n\n /** Raw GET returning the `data` value. Escape hatch for new endpoints. */\n async get<T = unknown>(path: string, params?: Query): Promise<T> {\n return (await this.#request<T>('GET', path, { params })).data;\n }\n\n /** Raw GET returning the whole `{data, meta}` envelope. */\n async getWithMeta<T = unknown>(path: string, params?: Query): Promise<Envelope<T>> {\n return this.#request<T>('GET', path, { params });\n }\n\n async *#paginate<T>(path: string, params: Query, opts: PageOptions = {}): AsyncGenerator<T, void, void> {\n // Never fetch a bigger page than the caller wants rows: `limit: 3` used\n // to pull 100 rows and throw 97 away, burning the caller's quota on a\n // request they did not ask for (and, on a trial key, a noticeable slice\n // of the 100 they get).\n const pageSize = Math.min(100, opts.limit ?? 100);\n const query: Query = { limit: pageSize, ...params };\n let seen = 0;\n for (;;) {\n const env = await this.#request<T[]>('GET', path, { params: query });\n for (const row of env.data ?? []) {\n yield row;\n seen += 1;\n if (opts.limit !== undefined && seen >= opts.limit) return;\n }\n const cursor = env.meta?.pagination?.next_cursor;\n if (!cursor) return;\n query.cursor = cursor;\n }\n }\n\n /* --------------------------------------------------------------- plans */\n\n /**\n * Plans (Free first), quotas, the free-plan rule, the MCP endpoint and the doc\n * links. The only endpoint that answers without a credential.\n */\n async plans(): Promise<Plans> {\n return (await this.#request<Plans>('GET', 'plans', { open: true })).data;\n }\n\n /* ---------------------------------------------------------------- orgs */\n\n /** Launch orgs with capability flags (stats / rounds / rankings / broadcasts / predictions / scorecards / odds). */\n orgs(): Promise<Org[]> {\n return this.get<Org[]>('orgs');\n }\n\n org(slug: string): Promise<Org> {\n return this.get<Org>(`orgs/${encodeURIComponent(slug)}`);\n }\n\n /**\n * One weight class in one promotion: its rankings board (null where the\n * promotion publishes none), upcoming bouts at that weight, the latest\n * results and the roster by recency. `division` is a slug, e.g.\n * `lightweight` or `womens-strawweight`.\n */\n orgDivision(org: string, division: string): Promise<OrgDivision> {\n return this.get<OrgDivision>(`orgs/${encodeURIComponent(org)}/divisions/${encodeURIComponent(division)}`);\n }\n\n /* -------------------------------------------------------------- events */\n\n /**\n * Schedule + results. Bare call = the upcoming calendar, soonest first.\n * `status: 'completed'` (or `order: 'desc'`) browses the archive\n * newest-first; `status: 'upcoming'` = every card not yet over (announced,\n * scheduled or live). `from` / `to` are `YYYY-MM-DD`.\n */\n events(\n opts: {\n org?: string;\n status?: string;\n from?: string;\n to?: string;\n order?: 'asc' | 'desc';\n /** Only cards with (true) / without (false) a title bout. */\n isTitleCard?: boolean;\n /** Only PPV (true) / non-PPV (false) cards. */\n isPpv?: boolean;\n /** `headline` adds each card's main event. */\n include?: EventListInclude[];\n limit?: number;\n } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, isTitleCard, isPpv, include, ...params } = opts;\n return this.#paginate<EventSummary>('events', {\n ...params,\n is_title_card: isTitleCard,\n is_ppv: isPpv,\n include: include?.length ? include.join(',') : undefined,\n } as Query, { limit });\n }\n\n /**\n * One event with its full fight card, venue and broadcasts.\n * `include: ['eta']` adds an estimated start time to every bout;\n * `include: ['odds']` adds each bout's current consensus line (the closing line once settled) (null when\n * unpriced). Pass both as `['eta', 'odds']`.\n */\n event(idOrSlug: string | number, opts: { include?: EventInclude[] } = {}): Promise<EventDetail> {\n return this.get<EventDetail>(\n `events/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * Who airs one event, per country: the promotion's rights deals for the\n * event's series merged with the event's own listings. `country` (ISO-2)\n * narrows to that market plus worldwide.\n */\n eventWatch(idOrSlug: string | number, opts: { country?: string } = {}): Promise<EventWatch> {\n return this.get<EventWatch>(`events/${encodeURIComponent(String(idOrSlug))}/watch`, opts as Query);\n }\n\n /**\n * The talking points of one card as of its start: title fights and\n * eliminators, the closest bout (UFCalendar model, else Power Index — not\n * betting advice), rematches and trilogy deciders, streaks, debuts and\n * returns, ranked fighters, nations, tallest / longest reach, the fastest\n * career finish.\n */\n eventStorylines(idOrSlug: string | number): Promise<EventStorylines> {\n return this.get<EventStorylines>(`events/${encodeURIComponent(String(idOrSlug))}/storylines`);\n }\n\n /**\n * How the UFCalendar community is picking each bout on one card: picks per\n * corner, the total and `pct_a`, in card order. Crowd sentiment from our\n * own pick'em game, not a market and not a forecast.\n */\n eventPickem(idOrSlug: string | number): Promise<EventPickem> {\n return this.get<EventPickem>(`events/${encodeURIComponent(String(idOrSlug))}/pickem`);\n }\n\n /**\n * The UFCalendar consensus odds for every non-cancelled bout on one card, in\n * card order: `consensus`, `opening`, `closing` (settled bouts), `movement`\n * and `points`. Unpriced bouts stay on the list with nulls and `points: 0`;\n * `lastMeta.priced` / `lastMeta.unpriced` count both. Information only, not\n * betting advice.\n */\n eventOdds(idOrSlug: string | number): Promise<EventOdds> {\n return this.get<EventOdds>(`events/${encodeURIComponent(String(idOrSlug))}/odds`);\n }\n\n /** Card-change diff log (fight added/removed, opponent swapped, date moved, profile merged). */\n eventChanges(idOrSlug: string | number): Promise<EventChange[]> {\n return this.get<EventChange[]>(`events/${encodeURIComponent(String(idOrSlug))}/changes`);\n }\n\n /**\n * The card-change feed across every event, newest first (default: the last\n * 90 days) — the `card.changed` webhook's audit trail, for callers that\n * poll. `since` is `YYYY-MM-DD` or an ISO-8601 datetime.\n */\n changes(\n opts: { org?: string; since?: string; kind?: ChangeKind; limit?: number } = {},\n ): AsyncGenerator<ChangeFeedEntry, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ChangeFeedEntry>('changes', params as Query, { limit });\n }\n\n /* -------------------------------------------------------------- fights */\n\n /** One bout with its result. `include: ['odds']` adds the current consensus line (the closing line once the bout is settled). */\n fight(fightId: number | string, opts: { include?: FightInclude[] } = {}): Promise<Fight> {\n return this.get<Fight>(\n `fights/${encodeURIComponent(String(fightId))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * The UFCalendar consensus line for one bout: `consensus` (latest point; the closing line once settled),\n * `opening`, `closing` (the last point at or before the event start,\n * settled bouts only), `movement` (opening → consensus in implied-probability\n * points on corner a) and `sources` on every point (how many sportsbooks\n * backed it; book identities are never exposed). An unpriced bout resolves\n * with null blocks and `points: 0`. Information only, not betting advice.\n */\n fightOdds(fightId: number | string): Promise<FightOdds> {\n return this.get<FightOdds>(`fights/${encodeURIComponent(String(fightId))}/odds`);\n }\n\n /**\n * Every consensus point for one bout, oldest first (Pro plans and up; a\n * lower plan throws `FightAPIError` 403 `tier_required`). A point is stored\n * only when the consensus moves. `from` / `to` are inclusive `YYYY-MM-DD`.\n */\n fightOddsHistory(\n fightId: number | string,\n opts: { from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<OddsHistoryPoint, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<OddsHistoryPoint>(\n `fights/${encodeURIComponent(String(fightId))}/odds/history`,\n params as Query,\n { limit },\n );\n }\n\n /**\n * Per-fight totals for both corners, each with `fantasy` — UFCalendar\n * fantasy points with a per-category breakdown and `complete`. The\n * data-quality flags ride in `lastMeta.quality` (`StatsQuality`).\n */\n fightStats(fightId: number | string): Promise<FightStatLine[]> {\n return this.get<FightStatLine[]>(`fights/${encodeURIComponent(String(fightId))}/stats`);\n }\n\n /** Round-by-round stat lines for both corners. */\n fightRounds(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/rounds`);\n }\n\n /**\n * The judges' scorecards for a bout — the official commission record:\n * decision type, point deductions, and one card per judge with every\n * round, the totals and `winner_fighter_id`. Scores are oriented to\n * `fighter_a_id` / `fighter_b_id`, both repeated on the payload.\n *\n * Check `scores_known` on a card before charting totals: when it is false\n * the commission published only the outcome. Throws 404 for a bout that\n * did not go to the judges.\n */\n fightScorecards(fightId: number | string): Promise<Scorecards> {\n return this.get<Scorecards>(`fights/${encodeURIComponent(String(fightId))}/scorecards`);\n }\n\n /**\n * The official in-fight log of one settled UFC bout (Pro plans and up; a\n * lower plan throws `FightAPIError` 403 `tier_required`): every logged\n * action in order, the referee stoppages paired with their reason and\n * real length, and every confirmed foul of the bout.\n *\n * The log labels only two fouls, the eye poke and the low blow. Any other\n * foul (an illegal knee to a grounded opponent, an upkick, a headbutt, a\n * bite, a fence grab) reaches it as a `generic` stoppage naming nobody, so\n * a foul is reported only when a record confirms it (`foul_basis` /\n * `basis`): `log` (the labelled row), `deduction` (the athletic commission\n * took a point) or `result` (the bout ended on it: a disqualification or a\n * \"could not continue\"). On a stoppage, `is_foul` says whether a foul is\n * confirmed, `foul` what it was, `committed_by` who committed it (null\n * when no record names a fighter), `points_deducted` and `ended_bout`; a\n * `generic` stoppage with no record behind it has `is_foul: false`.\n * `incidents` lists every confirmed foul in fight order, including one\n * with no stoppage in the log; `fouls.a` / `fouls.b` count what each\n * corner committed (`eye_pokes`, `low_blows`, `other`, `total`,\n * `points_deducted`). A recorded foul is not a ruling on intent.\n *\n * Coverage: UFC bouts from June 2013, stoppage reasons\n * from 8 December 2018 (`lastMeta.has_stoppage_reasons`). A bout with no\n * log, or one not settled yet, resolves with empty lists and\n * `lastMeta.note`.\n */\n fightTimeline(fightId: number | string): Promise<FightTimeline> {\n return this.get<FightTimeline>(`fights/${encodeURIComponent(String(fightId))}/timeline`);\n }\n\n /**\n * Position stats of one settled UFC bout (Pro plans and up): where it was\n * fought (`time`, shared by both fighters), each fighter's `control` by\n * position, and strikes by position and target — `totals` for the whole\n * bout, `rounds` per round. `null` means not tracked for that bout; `0`\n * is a real zero. Tracked reliably from 2007.\n */\n fightPositions(fightId: number | string): Promise<FightPositions> {\n return this.get<FightPositions>(`fights/${encodeURIComponent(String(fightId))}/positions`);\n }\n\n /**\n * Completed bouts, filtered — newest first unless `order: 'oldest'`. At\n * least one narrowing filter is required (`titleOnly`, `method`,\n * `division`, `fighter`, `winner`, `from`, `to`, `mainEventsOnly`); the\n * server serves 25 rows a page and at most 10 pages.\n */\n findFights(\n opts: {\n org?: string;\n titleOnly?: boolean;\n method?: FightSearchMethod;\n /** Division slug (`lightweight`) or a name fragment. */\n division?: string;\n /** Fighter slug or id — bouts they were in. */\n fighter?: string | number;\n /** Fighter slug or id — bouts they won. */\n winner?: string | number;\n from?: string;\n to?: string;\n mainEventsOnly?: boolean;\n order?: 'newest' | 'oldest';\n limit?: number;\n } = {},\n ): AsyncGenerator<FightSearchRow, void, void> {\n const { limit, titleOnly, mainEventsOnly, fighter, winner, ...rest } = opts;\n return this.#paginate<FightSearchRow>('fights/search', {\n ...rest,\n title_only: titleOnly,\n main_events_only: mainEventsOnly,\n fighter: fighter === undefined ? undefined : String(fighter),\n winner: winner === undefined ? undefined : String(winner),\n } as Query, { limit });\n }\n\n /* -------------------------------------------------------------- judges */\n\n /**\n * Every official who has scored a launch-org bout, busiest first. Rates\n * mean little below ~10 fights; pass `minFights: 10`.\n */\n judges(\n opts: { q?: string; org?: string; minFights?: number; limit?: number } = {},\n ): AsyncGenerator<Judge, void, void> {\n const { limit, minFights, ...rest } = opts;\n return this.#paginate<Judge>('judges', { ...rest, min_fights: minFights } as Query, { limit });\n }\n\n judge(judgeId: number | string): Promise<Judge> {\n return this.get<Judge>(`judges/${encodeURIComponent(String(judgeId))}`);\n }\n\n /**\n * Split and majority decisions, newest first, with every judge's card and\n * the dissenting judges named. Commission records only.\n */\n splitDecisions(\n opts: { org?: string; from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<SplitDecisionRow, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<SplitDecisionRow>('scorecards/splits', params as Query, { limit });\n }\n\n /**\n * Every card this judge has turned in, newest first, with `lone_dissent`,\n * `split` and the `colleagues`' totals on each row.\n */\n judgeScorecards(\n judgeId: number | string,\n opts: { limit?: number } = {},\n ): AsyncGenerator<JudgeScorecardRow, void, void> {\n return this.#paginate<JudgeScorecardRow>(\n `judges/${encodeURIComponent(String(judgeId))}/scorecards`,\n {},\n opts,\n );\n }\n\n /* ------------------------------------------------------------ referees */\n\n /**\n * Every referee who has worked a settled launch-org bout, busiest first:\n * bouts, promotions, finish rate, method mix and average fight time. The\n * id is a slug of the name; `q` is accent- and spacing-insensitive.\n */\n referees(opts: { q?: string; org?: string; limit?: number } = {}): AsyncGenerator<Referee, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<Referee>('referees', params as Query, { limit });\n }\n\n /** One referee's career aggregates, e.g. `referee('herb-dean')`. */\n referee(slug: string): Promise<Referee> {\n return this.get<Referee>(`referees/${encodeURIComponent(slug)}`);\n }\n\n /** Every settled bout one referee worked, newest first (the bout plus its `event`). */\n refereeFights(slug: string, opts: { limit?: number } = {}): AsyncGenerator<RefereeFightRow, void, void> {\n return this.#paginate<RefereeFightRow>(`referees/${encodeURIComponent(slug)}/fights`, {}, opts);\n }\n\n /* ------------------------------------------------------------ coverage */\n\n /**\n * What the database holds per launch org per year: events, settled bouts\n * and how many carry stats, round stats, commission scorecards and a\n * consensus odds line, with `totals` and `last_result_at`.\n */\n coverage(opts: { org?: string } = {}): Promise<OrgCoverage[]> {\n return this.get<OrgCoverage[]>('coverage', opts.org ? { org: opts.org } : undefined);\n }\n\n /* ------------------------------------------------------------ fighters */\n\n fighters(\n opts: { q?: string; org?: string; country?: string; limit?: number } = {},\n ): AsyncGenerator<FighterSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<FighterSummary>('fighters', params as Query, { limit });\n }\n\n /**\n * Bio, records, career stats, Power Index, CC-licensed images, `next_fight`\n * and `last_fight`. `include: ['bonuses']` adds the UFC bonus ledger;\n * `include: ['credentials']` adds grappling and wrestling pedigree, gyms and\n * coaches (every row with `sources` and a `confidence` grade).\n */\n fighter(idOrSlug: string | number, opts: { include?: FighterInclude[] } = {}): Promise<Fighter> {\n return this.get<Fighter>(\n `fighters/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /** Complete multi-promotion career timeline. */\n fighterHistory(idOrSlug: string | number): Promise<CareerBout[]> {\n return this.get<CareerBout[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/history`);\n }\n\n /** Raw career stat rows, one source-stamped row per scope (`pro-mma`, `ufc-only` …).\n * For the readable split use `fighter().records` / `fighter().stats`. */\n fighterStats(idOrSlug: string | number): Promise<CareerStats[]> {\n return this.get<CareerStats[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/stats`);\n }\n\n /** Every ranking row the fighter ever held, newest first, across every board\n * (`board` is `official` / `meta`; `is_champion` when rank 0). The endpoint is\n * cursor-paginated since 2026-09-24 — this walks every page so the array is\n * complete (a long career is 900+ rows). */\n async fighterRankings(idOrSlug: string | number): Promise<Record<string, unknown>[]> {\n const out: Record<string, unknown>[] = [];\n for await (const row of this.#paginate<Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/rankings`, { limit: 500 } as Query)) out.push(row);\n return out;\n }\n\n fighterPowerIndex(idOrSlug: string | number): Promise<PowerIndex & Record<string, unknown>> {\n return this.get<PowerIndex & Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/power-index`,\n );\n }\n\n /**\n * The confirmed fouls in a fighter's UFC bouts since 8 December 2018 (Pro\n * plans and up), committed and drawn: eye pokes and low blows from the\n * official in-fight log, plus any other foul (an illegal knee to a\n * grounded opponent, an upkick, a headbutt, a bite, a fence grab)\n * confirmed by the athletic commission's point deduction or by the\n * official result. `committed` / `drawn` count `total`, `eye_pokes`,\n * `low_blows` and `other`; `points_deducted` is what the commission has\n * taken from this fighter; `incidents` lists every confirmed foul, most\n * recent first, with `reason` (the foul), `basis` (`log`, `deduction` or\n * `result`), `points_deducted` and `ended_bout`. A `generic` stoppage with\n * no record behind it is never counted. A recorded foul is not a ruling on\n * intent. Resolves `null` (with `lastMeta.note`) under 3 tracked bouts\n * with no recorded foul.\n */\n fighterDiscipline(idOrSlug: string | number): Promise<FighterDiscipline | null> {\n return this.get<FighterDiscipline | null>(`fighters/${encodeURIComponent(String(idOrSlug))}/discipline`);\n }\n\n /**\n * A fighter's career position profile (Pro plans and up): the share of\n * cage time at distance, in the clinch and on the ground, and control\n * seconds for and against by position. Resolves `null` (with\n * `lastMeta.note`) under 3 bouts with tracked positions.\n */\n fighterPositions(idOrSlug: string | number): Promise<FighterPositions | null> {\n return this.get<FighterPositions | null>(`fighters/${encodeURIComponent(String(idOrSlug))}/positions`);\n }\n\n /**\n * Two fighters side by side (slugs or ids): bios with age, career stats,\n * strike mix, win streaks, previous meetings, common opponents, the booked\n * bout between them, the UFCalendar model prediction for it (UFC; not\n * betting advice) and Power Index ratings.\n */\n compare(a: string | number, b: string | number): Promise<Compare> {\n return this.get<Compare>('compare', { a: String(a), b: String(b) });\n }\n\n /* ------------------------------------------------------------ rankings */\n\n /**\n * Official board, point-in-time. `date: 'YYYY-MM-DD'` returns the board\n * that was valid on that day (UFC history back to 2013; rank 0 = champion).\n */\n rankings(org = 'ufc', opts: { date?: string; board?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(`rankings/${encodeURIComponent(org)}`, opts as Query);\n }\n\n divisionRankings(org: string, division: string, opts: { date?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(\n `rankings/${encodeURIComponent(org)}/${encodeURIComponent(division)}`,\n opts as Query,\n );\n }\n\n /** Current champions across every launch org, or one `org` / `division`. */\n champions(opts: { org?: string; division?: string } = {}): Promise<Champion[]> {\n return this.get<Champion[]>('champions', opts);\n }\n\n /**\n * UFCalendar Power Index board. `view: 'movers'` = biggest risers over\n * `days` (default 365), `view: 'peaks'` = all-time peak ratings;\n * `division` narrows any view.\n */\n powerIndex(\n org = 'ufc',\n opts: { view?: PowerIndexView; division?: string; days?: number; limit?: number } = {},\n ): Promise<(PowerIndexRow | PowerIndexMover)[]> {\n return this.get<(PowerIndexRow | PowerIndexMover)[]>(`power-index/${encodeURIComponent(org)}`, {\n view: opts.view,\n division: opts.division,\n days: opts.days,\n limit: opts.limit,\n });\n }\n\n /* ---------------------------------------------------------- matchmaker */\n\n /**\n * UFCalendar's matchmaker: the fights worth making in one MMA promotion,\n * scored 0–100, across the roster or for one `division` (`lastMeta.divisions`\n * lists the valid ones). Not a list of bookings; computed without the\n * site's Fight DNA factor.\n */\n matchmaker(org = 'ufc', opts: { division?: string; limit?: number } = {}): Promise<Matchup[]> {\n return this.get<Matchup[]>(`matchmaker/${encodeURIComponent(org)}`, {\n division: opts.division,\n limit: opts.limit,\n });\n }\n\n /**\n * Who one fighter (slug or id) should fight next: the best-scored\n * opponents with the Power Index win probability for each, plus the bout\n * already booked (`booked_next`).\n */\n whosNext(fighter: string | number, opts: { limit?: number } = {}): Promise<WhosNext> {\n return this.get<WhosNext>(`matchmaker/next/${encodeURIComponent(String(fighter))}`, { limit: opts.limit });\n }\n\n /* --------------------------------------------------------------- stats */\n\n /**\n * One Record Book leaderboard for one promotion (`metric` e.g. `wins`,\n * `fastest_knockout`, `finish_rate`). Narrow with `division` (slug),\n * `country` (ISO-2) or `population: 'active'` — not `country` and\n * `active` together. `lastMeta.metric` names the unit and what\n * `value_secondary` means.\n */\n leaderboard(\n org: string,\n metric: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; limit?: number } = {},\n ): Promise<LeaderboardRow[]> {\n return this.get<LeaderboardRow[]>('stats/leaders', { org, metric, ...opts } as Query);\n }\n\n /**\n * Every leaderboard's top rows (`top`, default 10, max 25) for one\n * promotion, grouped by category.\n */\n recordBook(\n org: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; scope?: StatScope; top?: number } = {},\n ): Promise<RecordBookSection[]> {\n return this.get<RecordBookSection[]>('stats/record-book', { org, ...opts } as Query);\n }\n\n /**\n * One calendar year in numbers for one promotion, or every covered\n * promotion when `org` is omitted: events, title fights, finish methods,\n * divisions, fastest finishes, upsets, Power Index climbers, busiest\n * fighters, host countries and the most-used judges.\n */\n yearStats(year: number, opts: { org?: string } = {}): Promise<YearStats> {\n return this.get<YearStats>(`stats/years/${encodeURIComponent(String(year))}`, opts as Query);\n }\n\n /* ---------------------------------------------------------------- misc */\n\n /** Model win probabilities for upcoming UFC bouts; `event` narrows to one card. */\n predictionsUpcoming(opts: { event?: string | number } = {}): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(\n 'predictions/upcoming',\n opts.event !== undefined ? { event: String(opts.event) } : undefined,\n );\n }\n\n /**\n * Who airs the promotion, per ISO-2 country — the org-wide deals, or a UFC\n * sub-series grid with `series: 'dwcs' | 'rtufc'`.\n */\n broadcastRights(org = 'ufc', opts: { country?: string; series?: RightsSeries } = {}): Promise<BroadcastRight[]> {\n return this.get<BroadcastRight[]>(`broadcast-rights/${encodeURIComponent(org)}`, opts as Query);\n }\n\n /**\n * Venues that hosted a covered promotion, alphabetical. `q` (2+ chars)\n * matches name or city; `country` is an ISO-2 code or an English name.\n */\n venues(opts: { q?: string; country?: string; limit?: number } = {}): AsyncGenerator<Venue, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<Venue>('venues', params as Query, { limit });\n }\n\n venue(venueId: number | string): Promise<Venue> {\n return this.get<Venue>(`venues/${encodeURIComponent(String(venueId))}`);\n }\n\n /** Every covered event at one venue, newest first (`order: 'asc'` reverses). */\n venueEvents(\n venueId: number | string,\n opts: { status?: string; from?: string; to?: string; order?: 'asc' | 'desc'; limit?: number } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<EventSummary>(`venues/${encodeURIComponent(String(venueId))}/events`, params as Query, { limit });\n }\n\n /** Typeahead across fighters and events. */\n search(q: string): Promise<Record<string, unknown>> {\n return this.get<Record<string, unknown>>('search', { q });\n }\n\n /**\n * UFCalendar's own editorial archive, newest first. `q` (2+ chars) matches\n * title, summary or a tag; `tag` is exact; `locale` is one of the 13 site\n * languages (English fallback).\n */\n articles(\n opts: { q?: string; tag?: string; locale?: ArticleLocale; limit?: number } = {},\n ): AsyncGenerator<ArticleSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ArticleSummary>('articles', params as Query, { limit });\n }\n\n /**\n * One article: full Markdown `body_md` (client widgets removed), author,\n * tags, `published_at`; `served_locale` names the language\n * delivered.\n */\n article(slug: string, opts: { locale?: ArticleLocale } = {}): Promise<Article> {\n return this.get<Article>(`articles/${encodeURIComponent(slug)}`, opts as Query);\n }\n\n /** Your key's month-to-date quota usage. */\n usage(): Promise<Usage> {\n return this.get<Usage>('usage');\n }\n\n /**\n * Subscribable ICS feed URL for calendar apps (authenticates via `?key=`).\n *\n * Throws without a key rather than returning `?key=`: that empty URL is\n * pasted into a calendar app, fails there hours later, and the failure\n * surfaces nowhere near this call.\n */\n calendarIcsUrl(org = 'ufc'): string {\n if (!this.apiKey) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (free plan: 100 requests/month, no card) live at https://www.ufcalendar.com/account/api',\n );\n }\n return `${this.baseUrl}/calendar/${encodeURIComponent(org)}.ics?key=${encodeURIComponent(this.apiKey)}`;\n }\n\n /* ------------------------------------------------------------ webhooks */\n\n webhookEndpoints(): Promise<WebhookEndpoint[]> {\n return this.get<WebhookEndpoint[]>('webhook-endpoints');\n }\n\n /**\n * Register a signed webhook (Pro and up). `events` ⊆ `event.announced`,\n * `fight.result`, `card.changed`, `event.completed`, `odds.moved` (the\n * consensus line on an upcoming bout moved 5+ implied-probability points or\n * the favourite flipped). The signing secret is returned ONCE, in this\n * response.\n */\n async createWebhookEndpoint(url: string, events?: string[]): Promise<WebhookEndpoint> {\n const body: Record<string, unknown> = { url };\n if (events?.length) body.events = events;\n return (await this.#request<WebhookEndpoint>('POST', 'webhook-endpoints', { body })).data;\n }\n\n async deleteWebhookEndpoint(endpointId: number | string): Promise<void> {\n await this.#request<unknown>('DELETE', `webhook-endpoints/${encodeURIComponent(String(endpointId))}`);\n }\n\n async rotateWebhookSecret(endpointId: number | string): Promise<WebhookEndpoint> {\n return (\n await this.#request<WebhookEndpoint>(\n 'POST',\n `webhook-endpoints/${encodeURIComponent(String(endpointId))}/rotate-secret`,\n )\n ).data;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,UAAU;;;ACmFhB,IAAM,mBAAmB;AAChC,IAAM,qBAAqB;AAEpB,IAAM,sBAAsB;AAM5B,IAAM,0BAA0B;AACvC,IAAM,kBAAkB;AA2BjB,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,MAAc,SAAiB,YAA2B,MAAM;AAC1F,UAAM,GAAG,MAAM,IAAI,IAAI,KAAK,OAAO,GAAG,YAAY,gBAAgB,SAAS,MAAM,EAAE,EAAE;AACrF,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,YAAY;AAAA,EACnB;AACF;AAgBA,SAAS,kBAA2B;AAClC,SAAO,OAAO,aAAa,eAAe,OAAO,WAAW;AAC9D;AAGA,SAAS,kBAAkB,OAAqC;AAC9D,MAAI,UAAU,KAAM,QAAO;AAC3B,QAAM,IAAI,MAAM,KAAK;AACrB,MAAI,MAAM,GAAI,QAAO;AACrB,MAAI,OAAO,OAAO,CAAC;AACnB,MAAI,CAAC,OAAO,SAAS,IAAI,GAA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