From 622856ff2f8ddcafb90d89dda245388a8af2ad3b Mon Sep 17 00:00:00 2001 From: Matt Anikiej Date: Mon, 27 Oct 2025 17:05:36 -0700 Subject: [PATCH 1/3] add edge ap endpoints --- nhlpy/api/edge.py | 443 ++++++++++++++++++++++++++++++++++++++++++++ nhlpy/nhl_client.py | 3 +- tests/test_edge.py | 330 +++++++++++++++++++++++++++++++++ 3 files changed, 775 insertions(+), 1 deletion(-) create mode 100644 nhlpy/api/edge.py create mode 100644 tests/test_edge.py diff --git a/nhlpy/api/edge.py b/nhlpy/api/edge.py new file mode 100644 index 0000000..19517e2 --- /dev/null +++ b/nhlpy/api/edge.py @@ -0,0 +1,443 @@ +from typing import Dict, Any + +from nhlpy.http_client import HttpClient, Endpoint + + +class Edge: + def __init__(self, http_client: HttpClient) -> None: + self.client = http_client + + # ======================== + # SKATER ENDPOINTS + # ======================== + + def skater_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE skater detail statistics for a specific player. + + Retrieves detailed EDGE statistics including shot speed, skating speed, distance traveled, + and zone time data for a skater. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. + game_type (int, optional): Type of games: + 2: Regular season + 3: Playoffs + + Returns: + dict: Dictionary containing detailed EDGE statistics for the skater + + Example: + client.edge.skater_detail(player_id=8478402) + client.edge.skater_detail(player_id=8478402, season=20232024, game_type=2) + """ + if season is None or game_type is None: + resource = f"edge/skater-detail/{player_id}/now" + else: + resource = f"edge/skater-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def skater_shot_speed_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE shot speed details for a specific skater. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Shot speed statistics including maximum and average speeds + """ + if season is None or game_type is None: + resource = f"edge/skater-shot-speed-detail/{player_id}/now" + else: + resource = f"edge/skater-shot-speed-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def skater_skating_speed_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE skating speed details for a specific skater. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Skating speed statistics including burst speed and average speed + """ + if season is None or game_type is None: + resource = f"edge/skater-skating-speed-detail/{player_id}/now" + else: + resource = f"edge/skater-skating-speed-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def skater_shot_location_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE shot location details for a specific skater. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Shot location data including shooting patterns and heat maps + """ + if season is None or game_type is None: + resource = f"edge/skater-shot-location-detail/{player_id}/now" + else: + resource = f"edge/skater-shot-location-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def skater_skating_distance_detail( + self, player_id: int, season: int = None, game_type: int = None + ) -> Dict[str, Any]: + """Get NHL EDGE skating distance details for a specific skater. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Distance traveled statistics per game and per shift + """ + if season is None or game_type is None: + resource = f"edge/skater-skating-distance-detail/{player_id}/now" + else: + resource = f"edge/skater-skating-distance-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def skater_comparison(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE comparison statistics for a specific skater. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Comparison data relative to league averages + """ + if season is None or game_type is None: + resource = f"edge/skater-comparison/{player_id}/now" + else: + resource = f"edge/skater-comparison/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def skater_zone_time(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE zone time details for a specific skater. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Time spent in offensive, defensive, and neutral zones + """ + if season is None or game_type is None: + resource = f"edge/skater-zone-time/{player_id}/now" + else: + resource = f"edge/skater-zone-time/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def skater_landing(self, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE skater landing page data. + + Retrieves league-wide skater EDGE statistics overview. + + Args: + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Overview of league-wide skater EDGE statistics + """ + if season is None or game_type is None: + resource = "edge/skater-landing/now" + else: + resource = f"edge/skater-landing/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def cat_skater_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL CAT (Catch All Tracking) EDGE skater details. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: CAT EDGE statistics for the skater + """ + if season is None or game_type is None: + resource = f"cat/edge/skater-detail/{player_id}/now" + else: + resource = f"cat/edge/skater-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + # ======================== + # GOALIE ENDPOINTS + # ======================== + + def goalie_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE goalie detail statistics for a specific player. + + Retrieves detailed EDGE statistics including save percentages, shot location data, + and 5v5 performance metrics for a goalie. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. + game_type (int, optional): Type of games: + 2: Regular season + 3: Playoffs + + Returns: + dict: Dictionary containing detailed EDGE statistics for the goalie + + Example: + client.edge.goalie_detail(player_id=8476945) + client.edge.goalie_detail(player_id=8476945, season=20232024, game_type=2) + """ + if season is None or game_type is None: + resource = f"edge/goalie-detail/{player_id}/now" + else: + resource = f"edge/goalie-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def goalie_shot_location_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE shot location details for a specific goalie. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Shot location data faced by the goalie including save percentages by zone + """ + if season is None or game_type is None: + resource = f"edge/goalie-shot-location-detail/{player_id}/now" + else: + resource = f"edge/goalie-shot-location-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def goalie_5v5_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE 5v5 performance details for a specific goalie. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: 5-on-5 performance statistics and save percentages + """ + if season is None or game_type is None: + resource = f"edge/goalie-5v5-detail/{player_id}/now" + else: + resource = f"edge/goalie-5v5-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def goalie_comparison(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE comparison statistics for a specific goalie. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Comparison data relative to league averages + """ + if season is None or game_type is None: + resource = f"edge/goalie-comparison/{player_id}/now" + else: + resource = f"edge/goalie-comparison/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def goalie_save_percentage_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE save percentage details for a specific goalie. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Detailed save percentage breakdowns by situation and location + """ + if season is None or game_type is None: + resource = f"edge/goalie-save-percentage-detail/{player_id}/now" + else: + resource = f"edge/goalie-save-percentage-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def goalie_landing(self, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE goalie landing page data. + + Retrieves league-wide goalie EDGE statistics overview. + + Args: + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Overview of league-wide goalie EDGE statistics + """ + if season is None or game_type is None: + resource = "edge/goalie-landing/now" + else: + resource = f"edge/goalie-landing/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def cat_goalie_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL CAT (Catch All Tracking) EDGE goalie details. + + Args: + player_id (int): The unique identifier for the NHL player + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: CAT EDGE statistics for the goalie + """ + if season is None or game_type is None: + resource = f"cat/edge/goalie-detail/{player_id}/now" + else: + resource = f"cat/edge/goalie-detail/{player_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + # ======================== + # TEAM ENDPOINTS + # ======================== + + def team_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE team detail statistics for a specific team. + + Retrieves detailed EDGE statistics including team skating metrics, shot data, + and zone time information. + + Args: + team_id (int): The unique identifier for the NHL team + season (int, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. + game_type (int, optional): Type of games: + 2: Regular season + 3: Playoffs + + Returns: + dict: Dictionary containing detailed EDGE statistics for the team + + Example: + client.edge.team_detail(team_id=10) + client.edge.team_detail(team_id=10, season=20232024, game_type=2) + """ + if season is None or game_type is None: + resource = f"edge/team-detail/{team_id}/now" + else: + resource = f"edge/team-detail/{team_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def team_skating_distance_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE skating distance details for a specific team. + + Args: + team_id (int): The unique identifier for the NHL team + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Team skating distance statistics per game and per player + """ + if season is None or game_type is None: + resource = f"edge/team-skating-distance-detail/{team_id}/now" + else: + resource = f"edge/team-skating-distance-detail/{team_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def team_zone_time_details(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE zone time details for a specific team. + + Args: + team_id (int): The unique identifier for the NHL team + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Team time spent in offensive, defensive, and neutral zones + """ + if season is None or game_type is None: + resource = f"edge/team-zone-time-details/{team_id}/now" + else: + resource = f"edge/team-zone-time-details/{team_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def team_shot_location_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE shot location details for a specific team. + + Args: + team_id (int): The unique identifier for the NHL team + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Team shot location data including shooting patterns and heat maps + """ + if season is None or game_type is None: + resource = f"edge/team-shot-location-detail/{team_id}/now" + else: + resource = f"edge/team-shot-location-detail/{team_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def team_landing(self, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE team landing page data. + + Retrieves league-wide team EDGE statistics overview. + + Args: + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Overview of league-wide team EDGE statistics + """ + if season is None or game_type is None: + resource = "edge/team-landing/now" + else: + resource = f"edge/team-landing/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def team_shot_speed_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE shot speed details for a specific team. + + Args: + team_id (int): The unique identifier for the NHL team + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Team shot speed statistics including maximum and average speeds + """ + if season is None or game_type is None: + resource = f"edge/team-shot-speed-detail/{team_id}/now" + else: + resource = f"edge/team-shot-speed-detail/{team_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() + + def team_skating_speed_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + """Get NHL EDGE skating speed details for a specific team. + + Args: + team_id (int): The unique identifier for the NHL team + season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + + Returns: + dict: Team skating speed statistics including burst speed and average speed + """ + if season is None or game_type is None: + resource = f"edge/team-skating-speed-detail/{team_id}/now" + else: + resource = f"edge/team-skating-speed-detail/{team_id}/{season}/{game_type}" + return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() diff --git a/nhlpy/nhl_client.py b/nhlpy/nhl_client.py index da914b6..efbb6f7 100644 --- a/nhlpy/nhl_client.py +++ b/nhlpy/nhl_client.py @@ -1,4 +1,4 @@ -from nhlpy.api import teams, standings, schedule, game_center, stats, misc, helpers, players +from nhlpy.api import teams, standings, schedule, game_center, stats, misc, helpers, players, edge from nhlpy.http_client import HttpClient from nhlpy.config import ClientConfig @@ -37,3 +37,4 @@ def __init__( self.misc = misc.Misc(http_client=self._http_client) self.helpers = helpers.Helpers(http_client=self._http_client) self.players = players.Players(http_client=self._http_client) + self.edge = edge.Edge(http_client=self._http_client) diff --git a/tests/test_edge.py b/tests/test_edge.py new file mode 100644 index 0000000..752ed88 --- /dev/null +++ b/tests/test_edge.py @@ -0,0 +1,330 @@ +from unittest import mock + + +@mock.patch("httpx.Client.get") +def test_skater_detail_now(mock_get, nhl_client): + nhl_client.edge.skater_detail(player_id=8478402) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-detail/8478402/now" + + +@mock.patch("httpx.Client.get") +def test_skater_detail_with_season_and_game_type(mock_get, nhl_client): + nhl_client.edge.skater_detail(player_id=8478402, season=20242025, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-detail/8478402/20242025/2" + + +@mock.patch("httpx.Client.get") +def test_skater_detail_with_season(mock_get, nhl_client): + nhl_client.edge.skater_detail(player_id=8478402, season=20232024, game_type=3) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-detail/8478402/20232024/3" + + +@mock.patch("httpx.Client.get") +def test_goalie_detail_now(mock_get, nhl_client): + nhl_client.edge.goalie_detail(player_id=8476945) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-detail/8476945/now" + + +@mock.patch("httpx.Client.get") +def test_goalie_detail_with_season(mock_get, nhl_client): + nhl_client.edge.goalie_detail(player_id=8476945, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-detail/8476945/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_skater_shot_speed_detail_now(mock_get, nhl_client): + nhl_client.edge.skater_shot_speed_detail(player_id=1) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-shot-speed-detail/1/now" + + +@mock.patch("httpx.Client.get") +def test_skater_shot_speed_detail_with_season(mock_get, nhl_client): + nhl_client.edge.skater_shot_speed_detail(player_id=1, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-shot-speed-detail/1/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_skater_skating_speed_detail_now(mock_get, nhl_client): + nhl_client.edge.skater_skating_speed_detail(player_id=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-skating-speed-detail/2/now" + + +@mock.patch("httpx.Client.get") +def test_skater_skating_speed_detail_with_season(mock_get, nhl_client): + nhl_client.edge.skater_skating_speed_detail(player_id=2, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-skating-speed-detail/2/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_skater_shot_location_detail_now(mock_get, nhl_client): + nhl_client.edge.skater_shot_location_detail(player_id=3) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-shot-location-detail/3/now" + + +@mock.patch("httpx.Client.get") +def test_skater_shot_location_detail_with_season(mock_get, nhl_client): + nhl_client.edge.skater_shot_location_detail(player_id=3, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-shot-location-detail/3/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_skater_skating_distance_detail_now(mock_get, nhl_client): + nhl_client.edge.skater_skating_distance_detail(player_id=4) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-skating-distance-detail/4/now" + + +@mock.patch("httpx.Client.get") +def test_skater_skating_distance_detail_with_season(mock_get, nhl_client): + nhl_client.edge.skater_skating_distance_detail(player_id=4, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-skating-distance-detail/4/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_skater_comparison_now(mock_get, nhl_client): + nhl_client.edge.skater_comparison(player_id=5) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-comparison/5/now" + + +@mock.patch("httpx.Client.get") +def test_skater_comparison_with_season(mock_get, nhl_client): + nhl_client.edge.skater_comparison(player_id=5, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-comparison/5/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_skater_zone_time_now(mock_get, nhl_client): + nhl_client.edge.skater_zone_time(player_id=6) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-zone-time/6/now" + + +@mock.patch("httpx.Client.get") +def test_skater_zone_time_with_season(mock_get, nhl_client): + nhl_client.edge.skater_zone_time(player_id=6, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-zone-time/6/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_skater_landing_now(mock_get, nhl_client): + nhl_client.edge.skater_landing() + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-landing/now" + + +@mock.patch("httpx.Client.get") +def test_skater_landing_with_season(mock_get, nhl_client): + nhl_client.edge.skater_landing(season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/skater-landing/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_cat_skater_detail_now(mock_get, nhl_client): + nhl_client.edge.cat_skater_detail(player_id=7) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/cat/edge/skater-detail/7/now" + + +@mock.patch("httpx.Client.get") +def test_cat_skater_detail_with_season(mock_get, nhl_client): + nhl_client.edge.cat_skater_detail(player_id=7, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/cat/edge/skater-detail/7/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_goalie_shot_location_detail_now(mock_get, nhl_client): + nhl_client.edge.goalie_shot_location_detail(player_id=8) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-shot-location-detail/8/now" + + +@mock.patch("httpx.Client.get") +def test_goalie_shot_location_detail_with_season(mock_get, nhl_client): + nhl_client.edge.goalie_shot_location_detail(player_id=8, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-shot-location-detail/8/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_goalie_5v5_detail_now(mock_get, nhl_client): + nhl_client.edge.goalie_5v5_detail(player_id=9) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-5v5-detail/9/now" + + +@mock.patch("httpx.Client.get") +def test_goalie_5v5_detail_with_season(mock_get, nhl_client): + nhl_client.edge.goalie_5v5_detail(player_id=9, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-5v5-detail/9/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_goalie_comparison_now(mock_get, nhl_client): + nhl_client.edge.goalie_comparison(player_id=10) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-comparison/10/now" + + +@mock.patch("httpx.Client.get") +def test_goalie_comparison_with_season(mock_get, nhl_client): + nhl_client.edge.goalie_comparison(player_id=10, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-comparison/10/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_goalie_save_percentage_detail_now(mock_get, nhl_client): + nhl_client.edge.goalie_save_percentage_detail(player_id=11) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-save-percentage-detail/11/now" + + +@mock.patch("httpx.Client.get") +def test_goalie_save_percentage_detail_with_season(mock_get, nhl_client): + nhl_client.edge.goalie_save_percentage_detail(player_id=11, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-save-percentage-detail/11/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_goalie_landing_now(mock_get, nhl_client): + nhl_client.edge.goalie_landing() + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-landing/now" + + +@mock.patch("httpx.Client.get") +def test_goalie_landing_with_season(mock_get, nhl_client): + nhl_client.edge.goalie_landing(season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/goalie-landing/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_cat_goalie_detail_now(mock_get, nhl_client): + nhl_client.edge.cat_goalie_detail(player_id=12) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/cat/edge/goalie-detail/12/now" + + +@mock.patch("httpx.Client.get") +def test_cat_goalie_detail_with_season(mock_get, nhl_client): + nhl_client.edge.cat_goalie_detail(player_id=12, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/cat/edge/goalie-detail/12/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_team_detail_now(mock_get, nhl_client): + nhl_client.edge.team_detail(team_id=13) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-detail/13/now" + + +@mock.patch("httpx.Client.get") +def test_team_detail_with_season(mock_get, nhl_client): + nhl_client.edge.team_detail(team_id=13, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-detail/13/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_team_skating_distance_detail_now(mock_get, nhl_client): + nhl_client.edge.team_skating_distance_detail(team_id=14) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-skating-distance-detail/14/now" + + +@mock.patch("httpx.Client.get") +def test_team_skating_distance_detail_with_season(mock_get, nhl_client): + nhl_client.edge.team_skating_distance_detail(team_id=14, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-skating-distance-detail/14/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_team_zone_time_details_now(mock_get, nhl_client): + nhl_client.edge.team_zone_time_details(team_id=15) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-zone-time-details/15/now" + + +@mock.patch("httpx.Client.get") +def test_team_zone_time_details_with_season(mock_get, nhl_client): + nhl_client.edge.team_zone_time_details(team_id=15, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-zone-time-details/15/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_team_shot_location_detail_now(mock_get, nhl_client): + nhl_client.edge.team_shot_location_detail(team_id=16) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-shot-location-detail/16/now" + + +@mock.patch("httpx.Client.get") +def test_team_shot_location_detail_with_season(mock_get, nhl_client): + nhl_client.edge.team_shot_location_detail(team_id=16, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-shot-location-detail/16/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_team_landing_now(mock_get, nhl_client): + nhl_client.edge.team_landing() + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-landing/now" + + +@mock.patch("httpx.Client.get") +def test_team_landing_with_season(mock_get, nhl_client): + nhl_client.edge.team_landing(season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-landing/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_team_shot_speed_detail_now(mock_get, nhl_client): + nhl_client.edge.team_shot_speed_detail(team_id=17) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-shot-speed-detail/17/now" + + +@mock.patch("httpx.Client.get") +def test_team_shot_speed_detail_with_season(mock_get, nhl_client): + nhl_client.edge.team_shot_speed_detail(team_id=17, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-shot-speed-detail/17/20232024/2" + + +@mock.patch("httpx.Client.get") +def test_team_skating_speed_detail_now(mock_get, nhl_client): + nhl_client.edge.team_skating_speed_detail(team_id=18) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-skating-speed-detail/18/now" + + +@mock.patch("httpx.Client.get") +def test_team_skating_speed_detail_with_season(mock_get, nhl_client): + nhl_client.edge.team_skating_speed_detail(team_id=18, season=20232024, game_type=2) + mock_get.assert_called_once() + assert mock_get.call_args[1]["url"] == "https://api-web.nhle.com/v1/edge/team-skating-speed-detail/18/20232024/2" From 89ed532d9b16dba5d040142f3de49eb6159a1377 Mon Sep 17 00:00:00 2001 From: Matt Anikiej Date: Thu, 30 Oct 2025 15:29:03 -0700 Subject: [PATCH 2/3] convert season, player, and team ids to str --- nhlpy/api/edge.py | 132 +++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/nhlpy/api/edge.py b/nhlpy/api/edge.py index 19517e2..5d4d3ff 100644 --- a/nhlpy/api/edge.py +++ b/nhlpy/api/edge.py @@ -11,15 +11,15 @@ def __init__(self, http_client: HttpClient) -> None: # SKATER ENDPOINTS # ======================== - def skater_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def skater_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE skater detail statistics for a specific player. Retrieves detailed EDGE statistics including shot speed, skating speed, distance traveled, and zone time data for a skater. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. game_type (int, optional): Type of games: 2: Regular season 3: Playoffs @@ -37,12 +37,12 @@ def skater_detail(self, player_id: int, season: int = None, game_type: int = Non resource = f"edge/skater-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_shot_speed_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def skater_shot_speed_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE shot speed details for a specific skater. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -54,12 +54,12 @@ def skater_shot_speed_detail(self, player_id: int, season: int = None, game_type resource = f"edge/skater-shot-speed-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_skating_speed_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def skater_skating_speed_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE skating speed details for a specific skater. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -71,12 +71,12 @@ def skater_skating_speed_detail(self, player_id: int, season: int = None, game_t resource = f"edge/skater-skating-speed-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_shot_location_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def skater_shot_location_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE shot location details for a specific skater. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -89,13 +89,13 @@ def skater_shot_location_detail(self, player_id: int, season: int = None, game_t return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() def skater_skating_distance_detail( - self, player_id: int, season: int = None, game_type: int = None + self, player_id: str, season: str = None, game_type: int = None ) -> Dict[str, Any]: """Get NHL EDGE skating distance details for a specific skater. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -107,12 +107,12 @@ def skater_skating_distance_detail( resource = f"edge/skater-skating-distance-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_comparison(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def skater_comparison(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE comparison statistics for a specific skater. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -124,12 +124,12 @@ def skater_comparison(self, player_id: int, season: int = None, game_type: int = resource = f"edge/skater-comparison/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_zone_time(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def skater_zone_time(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE zone time details for a specific skater. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -141,13 +141,13 @@ def skater_zone_time(self, player_id: int, season: int = None, game_type: int = resource = f"edge/skater-zone-time/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_landing(self, season: int = None, game_type: int = None) -> Dict[str, Any]: + def skater_landing(self, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE skater landing page data. Retrieves league-wide skater EDGE statistics overview. Args: - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -159,12 +159,12 @@ def skater_landing(self, season: int = None, game_type: int = None) -> Dict[str, resource = f"edge/skater-landing/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def cat_skater_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def cat_skater_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL CAT (Catch All Tracking) EDGE skater details. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -180,15 +180,15 @@ def cat_skater_detail(self, player_id: int, season: int = None, game_type: int = # GOALIE ENDPOINTS # ======================== - def goalie_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def goalie_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE goalie detail statistics for a specific player. Retrieves detailed EDGE statistics including save percentages, shot location data, and 5v5 performance metrics for a goalie. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. game_type (int, optional): Type of games: 2: Regular season 3: Playoffs @@ -206,12 +206,12 @@ def goalie_detail(self, player_id: int, season: int = None, game_type: int = Non resource = f"edge/goalie-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_shot_location_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def goalie_shot_location_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE shot location details for a specific goalie. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -223,12 +223,12 @@ def goalie_shot_location_detail(self, player_id: int, season: int = None, game_t resource = f"edge/goalie-shot-location-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_5v5_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def goalie_5v5_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE 5v5 performance details for a specific goalie. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -240,12 +240,12 @@ def goalie_5v5_detail(self, player_id: int, season: int = None, game_type: int = resource = f"edge/goalie-5v5-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_comparison(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def goalie_comparison(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE comparison statistics for a specific goalie. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -257,12 +257,12 @@ def goalie_comparison(self, player_id: int, season: int = None, game_type: int = resource = f"edge/goalie-comparison/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_save_percentage_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def goalie_save_percentage_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE save percentage details for a specific goalie. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -274,13 +274,13 @@ def goalie_save_percentage_detail(self, player_id: int, season: int = None, game resource = f"edge/goalie-save-percentage-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_landing(self, season: int = None, game_type: int = None) -> Dict[str, Any]: + def goalie_landing(self, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE goalie landing page data. Retrieves league-wide goalie EDGE statistics overview. Args: - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -292,12 +292,12 @@ def goalie_landing(self, season: int = None, game_type: int = None) -> Dict[str, resource = f"edge/goalie-landing/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def cat_goalie_detail(self, player_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def cat_goalie_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL CAT (Catch All Tracking) EDGE goalie details. Args: - player_id (int): The unique identifier for the NHL player - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + player_id (str): The unique identifier for the NHL player + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -313,15 +313,15 @@ def cat_goalie_detail(self, player_id: int, season: int = None, game_type: int = # TEAM ENDPOINTS # ======================== - def team_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def team_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE team detail statistics for a specific team. Retrieves detailed EDGE statistics including team skating metrics, shot data, and zone time information. Args: - team_id (int): The unique identifier for the NHL team - season (int, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. + team_id (str): The unique identifier for the NHL team + season (str, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. game_type (int, optional): Type of games: 2: Regular season 3: Playoffs @@ -339,12 +339,12 @@ def team_detail(self, team_id: int, season: int = None, game_type: int = None) - resource = f"edge/team-detail/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_skating_distance_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def team_skating_distance_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE skating distance details for a specific team. Args: - team_id (int): The unique identifier for the NHL team - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + team_id (str): The unique identifier for the NHL team + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -356,12 +356,12 @@ def team_skating_distance_detail(self, team_id: int, season: int = None, game_ty resource = f"edge/team-skating-distance-detail/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_zone_time_details(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def team_zone_time_details(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE zone time details for a specific team. Args: - team_id (int): The unique identifier for the NHL team - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + team_id (str): The unique identifier for the NHL team + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -373,12 +373,12 @@ def team_zone_time_details(self, team_id: int, season: int = None, game_type: in resource = f"edge/team-zone-time-details/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_shot_location_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def team_shot_location_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE shot location details for a specific team. Args: - team_id (int): The unique identifier for the NHL team - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + team_id (str): The unique identifier for the NHL team + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -390,13 +390,13 @@ def team_shot_location_detail(self, team_id: int, season: int = None, game_type: resource = f"edge/team-shot-location-detail/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_landing(self, season: int = None, game_type: int = None) -> Dict[str, Any]: + def team_landing(self, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE team landing page data. Retrieves league-wide team EDGE statistics overview. Args: - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -408,12 +408,12 @@ def team_landing(self, season: int = None, game_type: int = None) -> Dict[str, A resource = f"edge/team-landing/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_shot_speed_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def team_shot_speed_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE shot speed details for a specific team. Args: - team_id (int): The unique identifier for the NHL team - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + team_id (str): The unique identifier for the NHL team + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: @@ -425,12 +425,12 @@ def team_shot_speed_detail(self, team_id: int, season: int = None, game_type: in resource = f"edge/team-shot-speed-detail/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_skating_speed_detail(self, team_id: int, season: int = None, game_type: int = None) -> Dict[str, Any]: + def team_skating_speed_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: """Get NHL EDGE skating speed details for a specific team. Args: - team_id (int): The unique identifier for the NHL team - season (int, optional): Season in YYYYYYYY format (e.g., 20232024) + team_id (str): The unique identifier for the NHL team + season (str, optional): Season in YYYYYYYY format (e.g., 20232024) game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) Returns: From 3e69b2c185afc4c87cf58d16339734f794171869 Mon Sep 17 00:00:00 2001 From: Matt Anikiej Date: Thu, 30 Oct 2025 22:28:47 -0700 Subject: [PATCH 3/3] default endpoints to regular season --- nhlpy/api/edge.py | 138 +++++++++++++++++++++++----------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/nhlpy/api/edge.py b/nhlpy/api/edge.py index 5d4d3ff..1e5b3cd 100644 --- a/nhlpy/api/edge.py +++ b/nhlpy/api/edge.py @@ -11,7 +11,7 @@ def __init__(self, http_client: HttpClient) -> None: # SKATER ENDPOINTS # ======================== - def skater_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def skater_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE skater detail statistics for a specific player. Retrieves detailed EDGE statistics including shot speed, skating speed, distance traveled, @@ -20,7 +20,7 @@ def skater_detail(self, player_id: str, season: str = None, game_type: int = Non Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. - game_type (int, optional): Type of games: + game_type (int, optional): Type of games (defaults to 2): 2: Regular season 3: Playoffs @@ -31,146 +31,146 @@ def skater_detail(self, player_id: str, season: str = None, game_type: int = Non client.edge.skater_detail(player_id=8478402) client.edge.skater_detail(player_id=8478402, season=20232024, game_type=2) """ - if season is None or game_type is None: + if season is None: resource = f"edge/skater-detail/{player_id}/now" else: resource = f"edge/skater-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_shot_speed_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def skater_shot_speed_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE shot speed details for a specific skater. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Shot speed statistics including maximum and average speeds """ - if season is None or game_type is None: + if season is None: resource = f"edge/skater-shot-speed-detail/{player_id}/now" else: resource = f"edge/skater-shot-speed-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_skating_speed_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def skater_skating_speed_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE skating speed details for a specific skater. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Skating speed statistics including burst speed and average speed """ - if season is None or game_type is None: + if season is None: resource = f"edge/skater-skating-speed-detail/{player_id}/now" else: resource = f"edge/skater-skating-speed-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_shot_location_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def skater_shot_location_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE shot location details for a specific skater. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Shot location data including shooting patterns and heat maps """ - if season is None or game_type is None: + if season is None: resource = f"edge/skater-shot-location-detail/{player_id}/now" else: resource = f"edge/skater-shot-location-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() def skater_skating_distance_detail( - self, player_id: str, season: str = None, game_type: int = None + self, player_id: str, season: str = None, game_type: int = 2 ) -> Dict[str, Any]: """Get NHL EDGE skating distance details for a specific skater. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Distance traveled statistics per game and per shift """ - if season is None or game_type is None: + if season is None: resource = f"edge/skater-skating-distance-detail/{player_id}/now" else: resource = f"edge/skater-skating-distance-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_comparison(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def skater_comparison(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE comparison statistics for a specific skater. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Comparison data relative to league averages """ - if season is None or game_type is None: + if season is None: resource = f"edge/skater-comparison/{player_id}/now" else: resource = f"edge/skater-comparison/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_zone_time(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def skater_zone_time(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE zone time details for a specific skater. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Time spent in offensive, defensive, and neutral zones """ - if season is None or game_type is None: + if season is None: resource = f"edge/skater-zone-time/{player_id}/now" else: resource = f"edge/skater-zone-time/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def skater_landing(self, season: str = None, game_type: int = None) -> Dict[str, Any]: + def skater_landing(self, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE skater landing page data. Retrieves league-wide skater EDGE statistics overview. Args: season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Overview of league-wide skater EDGE statistics """ - if season is None or game_type is None: + if season is None: resource = "edge/skater-landing/now" else: resource = f"edge/skater-landing/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def cat_skater_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def cat_skater_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL CAT (Catch All Tracking) EDGE skater details. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: CAT EDGE statistics for the skater """ - if season is None or game_type is None: + if season is None: resource = f"cat/edge/skater-detail/{player_id}/now" else: resource = f"cat/edge/skater-detail/{player_id}/{season}/{game_type}" @@ -180,7 +180,7 @@ def cat_skater_detail(self, player_id: str, season: str = None, game_type: int = # GOALIE ENDPOINTS # ======================== - def goalie_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def goalie_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE goalie detail statistics for a specific player. Retrieves detailed EDGE statistics including save percentages, shot location data, @@ -189,7 +189,7 @@ def goalie_detail(self, player_id: str, season: str = None, game_type: int = Non Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. - game_type (int, optional): Type of games: + game_type (int, optional): Type of games (defaults to 2): 2: Regular season 3: Playoffs @@ -200,110 +200,110 @@ def goalie_detail(self, player_id: str, season: str = None, game_type: int = Non client.edge.goalie_detail(player_id=8476945) client.edge.goalie_detail(player_id=8476945, season=20232024, game_type=2) """ - if season is None or game_type is None: + if season is None: resource = f"edge/goalie-detail/{player_id}/now" else: resource = f"edge/goalie-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_shot_location_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def goalie_shot_location_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE shot location details for a specific goalie. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Shot location data faced by the goalie including save percentages by zone """ - if season is None or game_type is None: + if season is None: resource = f"edge/goalie-shot-location-detail/{player_id}/now" else: resource = f"edge/goalie-shot-location-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_5v5_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def goalie_5v5_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE 5v5 performance details for a specific goalie. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: 5-on-5 performance statistics and save percentages """ - if season is None or game_type is None: + if season is None: resource = f"edge/goalie-5v5-detail/{player_id}/now" else: resource = f"edge/goalie-5v5-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_comparison(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def goalie_comparison(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE comparison statistics for a specific goalie. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Comparison data relative to league averages """ - if season is None or game_type is None: + if season is None: resource = f"edge/goalie-comparison/{player_id}/now" else: resource = f"edge/goalie-comparison/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_save_percentage_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def goalie_save_percentage_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE save percentage details for a specific goalie. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Detailed save percentage breakdowns by situation and location """ - if season is None or game_type is None: + if season is None: resource = f"edge/goalie-save-percentage-detail/{player_id}/now" else: resource = f"edge/goalie-save-percentage-detail/{player_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def goalie_landing(self, season: str = None, game_type: int = None) -> Dict[str, Any]: + def goalie_landing(self, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE goalie landing page data. Retrieves league-wide goalie EDGE statistics overview. Args: season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Overview of league-wide goalie EDGE statistics """ - if season is None or game_type is None: + if season is None: resource = "edge/goalie-landing/now" else: resource = f"edge/goalie-landing/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def cat_goalie_detail(self, player_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def cat_goalie_detail(self, player_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL CAT (Catch All Tracking) EDGE goalie details. Args: player_id (str): The unique identifier for the NHL player season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: CAT EDGE statistics for the goalie """ - if season is None or game_type is None: + if season is None: resource = f"cat/edge/goalie-detail/{player_id}/now" else: resource = f"cat/edge/goalie-detail/{player_id}/{season}/{game_type}" @@ -313,7 +313,7 @@ def cat_goalie_detail(self, player_id: str, season: str = None, game_type: int = # TEAM ENDPOINTS # ======================== - def team_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def team_detail(self, team_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE team detail statistics for a specific team. Retrieves detailed EDGE statistics including team skating metrics, shot data, @@ -322,7 +322,7 @@ def team_detail(self, team_id: str, season: str = None, game_type: int = None) - Args: team_id (str): The unique identifier for the NHL team season (str, optional): Season in YYYYYYYY format (e.g., 20232024). Defaults to current season. - game_type (int, optional): Type of games: + game_type (int, optional): Type of games (defaults to 2): 2: Regular season 3: Playoffs @@ -333,110 +333,110 @@ def team_detail(self, team_id: str, season: str = None, game_type: int = None) - client.edge.team_detail(team_id=10) client.edge.team_detail(team_id=10, season=20232024, game_type=2) """ - if season is None or game_type is None: + if season is None: resource = f"edge/team-detail/{team_id}/now" else: resource = f"edge/team-detail/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_skating_distance_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def team_skating_distance_detail(self, team_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE skating distance details for a specific team. Args: team_id (str): The unique identifier for the NHL team season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Team skating distance statistics per game and per player """ - if season is None or game_type is None: + if season is None: resource = f"edge/team-skating-distance-detail/{team_id}/now" else: resource = f"edge/team-skating-distance-detail/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_zone_time_details(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def team_zone_time_details(self, team_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE zone time details for a specific team. Args: team_id (str): The unique identifier for the NHL team season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Team time spent in offensive, defensive, and neutral zones """ - if season is None or game_type is None: + if season is None: resource = f"edge/team-zone-time-details/{team_id}/now" else: resource = f"edge/team-zone-time-details/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_shot_location_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def team_shot_location_detail(self, team_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE shot location details for a specific team. Args: team_id (str): The unique identifier for the NHL team season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Team shot location data including shooting patterns and heat maps """ - if season is None or game_type is None: + if season is None: resource = f"edge/team-shot-location-detail/{team_id}/now" else: resource = f"edge/team-shot-location-detail/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_landing(self, season: str = None, game_type: int = None) -> Dict[str, Any]: + def team_landing(self, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE team landing page data. Retrieves league-wide team EDGE statistics overview. Args: season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Overview of league-wide team EDGE statistics """ - if season is None or game_type is None: + if season is None: resource = "edge/team-landing/now" else: resource = f"edge/team-landing/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_shot_speed_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def team_shot_speed_detail(self, team_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE shot speed details for a specific team. Args: team_id (str): The unique identifier for the NHL team season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Team shot speed statistics including maximum and average speeds """ - if season is None or game_type is None: + if season is None: resource = f"edge/team-shot-speed-detail/{team_id}/now" else: resource = f"edge/team-shot-speed-detail/{team_id}/{season}/{game_type}" return self.client.get(endpoint=Endpoint.API_WEB_V1, resource=resource).json() - def team_skating_speed_detail(self, team_id: str, season: str = None, game_type: int = None) -> Dict[str, Any]: + def team_skating_speed_detail(self, team_id: str, season: str = None, game_type: int = 2) -> Dict[str, Any]: """Get NHL EDGE skating speed details for a specific team. Args: team_id (str): The unique identifier for the NHL team season (str, optional): Season in YYYYYYYY format (e.g., 20232024) - game_type (int, optional): Type of games (2: Regular season, 3: Playoffs) + game_type (int, optional): Type of games (2: Regular season, 3: Playoffs). Defaults to 2. Returns: dict: Team skating speed statistics including burst speed and average speed """ - if season is None or game_type is None: + if season is None: resource = f"edge/team-skating-speed-detail/{team_id}/now" else: resource = f"edge/team-skating-speed-detail/{team_id}/{season}/{game_type}"