@bp1222/stats-api 0.5.0 → 0.7.4
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 +37 -0
- package/dist/index.d.ts +1204 -306
- package/dist/index.js +1546 -1010
- package/package.json +5 -4
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# MLB Stats API – OpenAPI spec and TypeScript client
|
|
2
|
+
|
|
3
|
+
OpenAPI 3.1 spec for the [MLB Stats API](https://statsapi.mlb.com/api) (undocumented). This repo is the source of truth for the spec and can generate a TypeScript client.
|
|
4
|
+
|
|
5
|
+
## Source of truth
|
|
6
|
+
|
|
7
|
+
- **Spec**: All editable spec content lives under `spec/`.
|
|
8
|
+
- Entry point: `spec/openapi.yaml`
|
|
9
|
+
- Paths: `spec/paths/*.yaml`
|
|
10
|
+
- Components: `spec/components/parameters/`, `spec/components/schemas/`
|
|
11
|
+
- **Generated artifacts** (not committed): `bundle.yaml` (bundled spec) and `src/` (TypeScript client). Generate them before building or publishing.
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
| Command | Description |
|
|
16
|
+
|-------------|---------------------------------------------------|
|
|
17
|
+
| `make lint` | Lint the spec (Redocly) |
|
|
18
|
+
| `make bundle` | Bundle the spec to `bundle.yaml` |
|
|
19
|
+
| `make gen-ts` | Generate TypeScript client from `bundle.yaml` into `src/` |
|
|
20
|
+
| Full build | `make bundle && make gen-ts && npm run build` (produces `dist/` for the published package) |
|
|
21
|
+
|
|
22
|
+
Install dependencies with `pnpm install` or `npm install`.
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
1. Edit only files under `spec/`.
|
|
27
|
+
2. Run `make lint` to check the spec.
|
|
28
|
+
3. Run `make bundle` then `make gen-ts` to regenerate the client.
|
|
29
|
+
4. Run `npm run build` to produce `dist/`.
|
|
30
|
+
|
|
31
|
+
## Upstream API
|
|
32
|
+
|
|
33
|
+
Base URL: `https://statsapi.mlb.com/api`. The upstream API is undocumented; this spec is maintained by mapping observed request/response behavior.
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
See `spec/openapi.yaml` and `package.json` for license and contact details.
|