Skip to main content

Interface: WrapperDef

Defined in: core/types.ts:52

A wrapper definition (data-driven; generated from the ESPN endpoint YAML). path is the full host-relative template, e.g. /{sport}/{league}/scoreboard (site) or /{sport}/leagues/{league}/seasons/{season} (core). Optional segments are bracketed and may contain literals + tokens — e.g. [/{token}] or [/groups/{group_id}] — and are dropped when their token(s) don't resolve.

"Flat API" wrappers (non-ESPN live APIs, e.g. the MLB Stats API) reuse the same shape but set flat: true and carry an absolute host + the family api stem + an optional parser name. For flat wrappers family is unused (the host is absolute, not an EspnFamily slug) and path need not contain {sport}/{league} — see src/core/flat.ts for the resolver.

Properties

api?

optional api?: string

Defined in: core/types.ts:66

Flat-API family stem, e.g. "mlb".


auth?

optional auth?: boolean

Defined in: core/types.ts:84

True for flat-API families that need a bearer token (e.g. nfl_api). The dispatch (src/leagues/_make_flat.ts) resolves auth headers via the AUTH_HEADER_PROVIDERS map for that api stem before fetching. Non-auth families omit this and behave exactly as before.


family?

optional family?: EspnFamily

Defined in: core/types.ts:58

ESPN URL family slug (keys into HOSTS). Present on every ESPN wrapper; omitted on flat-API wrappers (flat: true), which carry an absolute host.


flat?

optional flat?: boolean

Defined in: core/types.ts:64

True for non-ESPN "flat API" wrappers (see src/core/flat.ts).


host?

optional host?: string

Defined in: core/types.ts:68

Flat-API absolute base URL, e.g. "https://statsapi.mlb.com".


parser?

optional parser?: string

Defined in: core/types.ts:70

Registered parser name (resolved via src/parsers/_registry.ts).


path

path: string

Defined in: core/types.ts:60


pathParams

pathParams: PathParam[]

Defined in: core/types.ts:61


queryParams

queryParams: QueryParam[]

Defined in: core/types.ts:62


returnsSchema?

optional returnsSchema?: string

Defined in: core/types.ts:77

Returns-schema path (docs-only metadata) for a flat-API wrapper, relative to tools/codegen/schemas/ and without the .yaml suffix (e.g. "native/mlb/boxscore"). Drives the per-endpoint Returns tables in the generated reference docs; unused at runtime.


scope

scope: Scope

Defined in: core/types.ts:59


short

short: string

Defined in: core/types.ts:53