nhle-api 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.5.0] - 2025-11-10
9
+
10
+ ### Added
11
+
12
+ - TypeScript wrapper for NHLe API with full type safety
13
+ - Game Center API support (landing, play-by-play, boxscore)
14
+ - Team and player information endpoints
15
+ - Score and scoreboard endpoints
16
+ - Edge Stats API integration
17
+ - Edge Advanced Stats API integration
18
+ - Comprehensive TypeScript type definitions
19
+ - Query builder for Cayenne queries
20
+ - Environment configuration support
21
+
22
+ ### Changed
23
+
24
+ - Migrated build system to tsup with dedicated config file
25
+ - Updated package.json for correct ESM/CJS dual-format output
26
+
27
+ ### Infrastructure
28
+
29
+ - Added tsup.config.ts for centralized build configuration
30
+ - Configured dual ESM/CJS package exports
31
+ - Added MIT license
32
+ - Added changelog
33
+
34
+ ## [Unreleased]
35
+
36
+ ### Planned
37
+
38
+ - Additional API endpoint coverage
39
+ - Enhanced error handling
40
+ - More comprehensive examples and documentation
41
+ - Enhanced response types for better type safety
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 jbru
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # NHLe API Library
2
+
3
+ A TypeScript wrapper for the NHLe API with simple, composable functions and full type safety.
4
+
5
+ ## Overview
6
+
7
+ Access NHLe game data, player statistics, and team information through a clean, functional API. Built with TypeScript for complete type safety and designed for ease of use.
8
+
9
+ ## Installation
10
+
11
+ To install the package, run:
12
+
13
+ ```bash
14
+ npm install nhle-api
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Here are some basic examples of how to use the NHLe API library:
20
+
21
+ ```typescript
22
+ import { gc } from "nhle-api";
23
+
24
+ // Get game landing page data
25
+ const gameInfo = await gc.game.landing(2023020001);
26
+ console.log(gameInfo);
27
+
28
+ // Get live play-by-play
29
+ const playByPlay = await gc.game.playByPlay(2023020001);
30
+ console.log(playByPlay);
31
+
32
+ // Get boxscore
33
+ const boxscore = await gc.game.boxscore(2023020001);
34
+ console.log(boxscore);
35
+
36
+ // Get today's scores
37
+ const scores = await gc.score(new Date());
38
+ console.log(scores);
39
+
40
+ // Get current scoreboard
41
+ const scoreboard = await gc.scoreboard();
42
+ console.log(scoreboard);
43
+
44
+ // Get team roster
45
+ const roster = await gc.team.roster("TOR");
46
+ console.log(roster);
47
+
48
+ // Get player information
49
+ const player = await gc.player.landing(8478402); // Connor McDavid
50
+ console.log(player);
51
+ ```
52
+
53
+ ## Configuration
54
+
55
+ The library supports simple configuration through environment variables:
56
+
57
+ ```bash
58
+ # Set request timeout (in milliseconds, default: 5000)
59
+ export NHLE_API_TIMEOUT=10000
60
+
61
+ # Set language for responses (en or fr, default: en)
62
+ export NHLE_API_LANGUAGE=en
63
+
64
+ # Set logging level (silent, error, warn, info, debug; default: warn)
65
+ export NHLE_API_LOGLEVEL=debug
66
+ ```
67
+
68
+ For more details, see [Environment Configuration Documentation](docs/ENVIRONMENT_CONFIG.md).
69
+
70
+ ## API Reference
71
+
72
+ ### Gamecenter API (`gc`)
73
+
74
+ The primary API for accessing NHL game data, scores, team and player information (live and historical).
75
+
76
+ #### `gc.game` - Game Data
77
+
78
+ - `playByPlay(gameId)` - Get play-by-play data for a game
79
+ - `boxscore(gameId)` - Get boxscore for a game
80
+ - `landing(gameId)` - Get landing page data for a game
81
+ - `reports(gameId)` - Get game reports (right rail data)
82
+ - `schedule(date?)` - Get schedule for a specific date (defaults to today)
83
+ - `scheduleCalendar(date?)` - Get schedule calendar for a specific date
84
+ - `playoffBracket(year?)` - Get playoff bracket for a year
85
+ - `playoffSeries(season?)` - Get playoff series for a season
86
+ - `playoffSeriesSchedule(season, seriesLetter)` - Get schedule for a playoff series
87
+ - `whereToWatch()` - Get where to watch information
88
+ - `networkTVSchedule(date?)` - Get network TV schedule
89
+ - `wsc.gameStory(gameId)` - Get game story (web service)
90
+ - `wsc.playByPlay(gameId)` - Get play-by-play (web service)
91
+ - `pptReplay.goal(gameId, eventId)` - Get goal replay data
92
+ - `pptReplay.event(date?)` - Get replay events for a date
93
+
94
+ #### `gc.score` - Scores & Scoreboards
95
+
96
+ - `score(date?)` - Get scores for a specific date (defaults to today)
97
+ - `scoreboard()` - Get current scoreboard
98
+
99
+ #### `gc.team` - Team Data
100
+
101
+ - `roster(teamCode, season?)` - Get team roster
102
+ - `rosterSeasons(teamCode)` - Get available roster seasons
103
+ - `prospects(teamCode)` - Get team prospects
104
+ - `clubStats(teamCode, season?)` - Get club stats
105
+ - `clubStatsSeason(teamCode)` - Get club stats season
106
+ - `standings(date?)` - Get standings for a date
107
+ - `standingsSeason()` - Get standings by season
108
+ - `schedule.now(teamCode)` - Get team's current schedule
109
+ - `schedule.month(teamCode, month)` - Get team's schedule for a month
110
+ - `schedule.season(teamCode, season)` - Get team's schedule for a season
111
+
112
+ #### `gc.player` - Player Data
113
+
114
+ - `landing(playerId)` - Get player landing page data
115
+ - `gameLog(playerId, season?, gameType?)` - Get player game log
116
+ - `spotlight()` - Get featured players
117
+ - `search(query)` - Search for players
118
+ - `statsLeaders.season(season?, gameType?, category?, limit?)` - Get season stats leaders
119
+ - `statsLeaders.current(gameType?, category?, limit?)` - Get current stats leaders
120
+
121
+ #### `gc.draft` - Draft Data
122
+
123
+ - `picks(year?)` - Get draft picks for a year
124
+ - `tracker()` - Get draft tracker
125
+ - `rankings(year?)` - Get draft rankings
126
+
127
+ #### `gc.misc` - Miscellaneous
128
+
129
+ - `seasons()` - Get all NHL seasons
130
+ - `meta.game(gameId)` - Get game metadata
131
+ - `meta.gameVideo(gameId)` - Get game video metadata
132
+ - `postalLookup(postalCode)` - Lookup location by postal code
133
+ - `location()` - Get current location info
134
+ - `partnerGame(country, date?)` - Get partner game information
135
+
136
+ ### Edge Stats API (`stats`) - _In Development_
137
+
138
+ Historical and current NHL statistics (functionality being finalized)
139
+
140
+ ### Edge Advanced API (`adv`) - _In Development_
141
+
142
+ Advanced analytics endpoints (functionality being finalized)
143
+
144
+ ## Docs
145
+
146
+ - [Environment Configuration](docs/ENVIRONMENT_CONFIG.md) - Configure timeouts, language, and base URLs
147
+ - [Query Builder Guide](docs/QUERY_BUILDER_GUIDE.md) - Advanced query building for stats API
148
+
149
+ ## Support
150
+
151
+ If you find this library helpful, consider supporting its development:
152
+
153
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R01DV0JD)