diff --git a/Nhl.Api.Common/Helpers/TeamNames.cs b/Nhl.Api.Common/Helpers/TeamNames.cs index 07894ca8..def348c1 100644 --- a/Nhl.Api.Common/Helpers/TeamNames.cs +++ b/Nhl.Api.Common/Helpers/TeamNames.cs @@ -1,4 +1,4 @@ -namespace Nhl.Api.Common.Helpers; +namespace Nhl.Api.Common.Helpers; /// /// A helper class for all NHL team names @@ -164,4 +164,9 @@ public static class TeamNames /// Winnipeg Jets /// public const string WinnipegJets = "Winnipeg Jets"; + + /// + /// Utah Hockey Club + /// + public const string UtahHockeyClub = "Utah Hockey Club"; } diff --git a/Nhl.Api.Common/Http/NhlApiHttpClient.cs b/Nhl.Api.Common/Http/NhlApiHttpClient.cs index e1950e5e..c5bd4efe 100644 --- a/Nhl.Api.Common/Http/NhlApiHttpClient.cs +++ b/Nhl.Api.Common/Http/NhlApiHttpClient.cs @@ -1,9 +1,9 @@ -using Newtonsoft.Json; using System; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using Newtonsoft.Json; namespace Nhl.Api.Common.Http; /// diff --git a/Nhl.Api.Common/Nhl.Api.Common.csproj b/Nhl.Api.Common/Nhl.Api.Common.csproj index 00092548..0deac4f4 100644 --- a/Nhl.Api.Common/Nhl.Api.Common.csproj +++ b/Nhl.Api.Common/Nhl.Api.Common.csproj @@ -1,7 +1,7 @@ - 3.4.2 + 3.5.0 net8.0 true enable diff --git a/Nhl.Api.Common/Services/CachingService.cs b/Nhl.Api.Common/Services/CachingService.cs index 961a0d57..4a4c53f9 100644 --- a/Nhl.Api.Common/Services/CachingService.cs +++ b/Nhl.Api.Common/Services/CachingService.cs @@ -1,10 +1,10 @@ -using Newtonsoft.Json; using System; using System.Collections.Concurrent; using System.IO; using System.IO.Compression; using System.Text; using System.Threading.Tasks; +using Newtonsoft.Json; namespace Nhl.Api.Common.Services; /// diff --git a/Nhl.Api.Domain/Enumerations/Franchise/FranchiseEnum.cs b/Nhl.Api.Domain/Enumerations/Franchise/FranchiseEnum.cs index e4e4ebaa..6be77559 100644 --- a/Nhl.Api.Domain/Enumerations/Franchise/FranchiseEnum.cs +++ b/Nhl.Api.Domain/Enumerations/Franchise/FranchiseEnum.cs @@ -1,4 +1,4 @@ -namespace Nhl.Api.Models.Enumerations.Franchise; +namespace Nhl.Api.Models.Enumerations.Franchise; /// /// An enumeration of all NHL franchises @@ -160,5 +160,9 @@ public enum FranchiseEnum /// /// Seattle Kraken /// - SeattleKraken = 39 + SeattleKraken = 39, + /// + /// Utah Hockey Club + /// + UtahHockeyClub = 40 } diff --git a/Nhl.Api.Domain/Enumerations/Player/PlayerEnumFileGeneratorHelper.cs b/Nhl.Api.Domain/Enumerations/Player/PlayerEnumFileGeneratorHelper.cs index 1d7a1a7d..e3304a18 100644 --- a/Nhl.Api.Domain/Enumerations/Player/PlayerEnumFileGeneratorHelper.cs +++ b/Nhl.Api.Domain/Enumerations/Player/PlayerEnumFileGeneratorHelper.cs @@ -1,10 +1,10 @@ -using Nhl.Api.Common.Http; -using Nhl.Api.Models.Player; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; +using Nhl.Api.Common.Http; +using Nhl.Api.Models.Player; namespace Nhl.Api.Models.Enumerations.Player; /// diff --git a/Nhl.Api.Domain/Enumerations/Team/TeamEnum.cs b/Nhl.Api.Domain/Enumerations/Team/TeamEnum.cs index 9543fddf..3185661b 100644 --- a/Nhl.Api.Domain/Enumerations/Team/TeamEnum.cs +++ b/Nhl.Api.Domain/Enumerations/Team/TeamEnum.cs @@ -1,4 +1,4 @@ -namespace Nhl.Api.Models.Enumerations.Team; +namespace Nhl.Api.Models.Enumerations.Team; /// /// An enumeration for all active NHL teams @@ -132,5 +132,9 @@ public enum TeamEnum /// /// Seattle Kraken /// - SeattleKraken = 55 -} \ No newline at end of file + SeattleKraken = 55, + /// + /// Utah Hockey Club + /// + UtahHockeyClub = 59 +} diff --git a/Nhl.Api.Domain/Models/Game/GameCenterBoxScore.cs b/Nhl.Api.Domain/Models/Game/GameCenterBoxScore.cs index 9370201a..d311d548 100644 --- a/Nhl.Api.Domain/Models/Game/GameCenterBoxScore.cs +++ b/Nhl.Api.Domain/Models/Game/GameCenterBoxScore.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Game; /// diff --git a/Nhl.Api.Domain/Models/Game/GameCenterLanding.cs b/Nhl.Api.Domain/Models/Game/GameCenterLanding.cs index 97a11c88..9c08964d 100644 --- a/Nhl.Api.Domain/Models/Game/GameCenterLanding.cs +++ b/Nhl.Api.Domain/Models/Game/GameCenterLanding.cs @@ -1,8 +1,8 @@ +using System; +using System.Collections.Generic; using Newtonsoft.Json; using Nhl.Api.Models.Player; using Nhl.Api.Models.Standing; -using System; -using System.Collections.Generic; namespace Nhl.Api.Models.Game; /// diff --git a/Nhl.Api.Domain/Models/Game/GameCenterPlayByPlay.cs b/Nhl.Api.Domain/Models/Game/GameCenterPlayByPlay.cs index c7daf16e..81b3ebe7 100644 --- a/Nhl.Api.Domain/Models/Game/GameCenterPlayByPlay.cs +++ b/Nhl.Api.Domain/Models/Game/GameCenterPlayByPlay.cs @@ -1,7 +1,7 @@ -using Newtonsoft.Json; -using Nhl.Api.Models.Player; using System; using System.Collections.Generic; +using Newtonsoft.Json; +using Nhl.Api.Models.Player; namespace Nhl.Api.Models.Game; diff --git a/Nhl.Api.Domain/Models/Game/GameMetadata.cs b/Nhl.Api.Domain/Models/Game/GameMetadata.cs index 8553b02a..55e679dd 100644 --- a/Nhl.Api.Domain/Models/Game/GameMetadata.cs +++ b/Nhl.Api.Domain/Models/Game/GameMetadata.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Game; /// diff --git a/Nhl.Api.Domain/Models/Game/GameScore.cs b/Nhl.Api.Domain/Models/Game/GameScore.cs index 635ce3ba..b08b41d1 100644 --- a/Nhl.Api.Domain/Models/Game/GameScore.cs +++ b/Nhl.Api.Domain/Models/Game/GameScore.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Game; /// diff --git a/Nhl.Api.Domain/Models/Game/GameScoreboard.cs b/Nhl.Api.Domain/Models/Game/GameScoreboard.cs index 437ea4db..42288637 100644 --- a/Nhl.Api.Domain/Models/Game/GameScoreboard.cs +++ b/Nhl.Api.Domain/Models/Game/GameScoreboard.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Game; /// diff --git a/Nhl.Api.Domain/Models/Game/GoalieSeasonGameLog.cs b/Nhl.Api.Domain/Models/Game/GoalieSeasonGameLog.cs index 6f8644c3..9cdbafd7 100644 --- a/Nhl.Api.Domain/Models/Game/GoalieSeasonGameLog.cs +++ b/Nhl.Api.Domain/Models/Game/GoalieSeasonGameLog.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; +using System.Collections.Generic; +using Newtonsoft.Json; using Nhl.Api.Models.Team; -using System.Collections.Generic; namespace Nhl.Api.Models.Game; /// diff --git a/Nhl.Api.Domain/Models/Game/PlayerSeasonGameLog.cs b/Nhl.Api.Domain/Models/Game/PlayerSeasonGameLog.cs index 3d8ce3e3..616fd679 100644 --- a/Nhl.Api.Domain/Models/Game/PlayerSeasonGameLog.cs +++ b/Nhl.Api.Domain/Models/Game/PlayerSeasonGameLog.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; +using System.Collections.Generic; +using Newtonsoft.Json; using Nhl.Api.Models.Team; -using System.Collections.Generic; namespace Nhl.Api.Models.Game; /// diff --git a/Nhl.Api.Domain/Models/Game/TeamScoreboard.cs b/Nhl.Api.Domain/Models/Game/TeamScoreboard.cs index 039a5262..8ce3aa41 100644 --- a/Nhl.Api.Domain/Models/Game/TeamScoreboard.cs +++ b/Nhl.Api.Domain/Models/Game/TeamScoreboard.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Game; /// diff --git a/Nhl.Api.Domain/Models/Game/TvScheduleBroadcast.cs b/Nhl.Api.Domain/Models/Game/TvScheduleBroadcast.cs index 4832c1e6..d1dcb5dd 100644 --- a/Nhl.Api.Domain/Models/Game/TvScheduleBroadcast.cs +++ b/Nhl.Api.Domain/Models/Game/TvScheduleBroadcast.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Game; /// diff --git a/Nhl.Api.Domain/Models/League/LeagueMetadataInformation.cs b/Nhl.Api.Domain/Models/League/LeagueMetadataInformation.cs index f287b181..bf6234fc 100644 --- a/Nhl.Api.Domain/Models/League/LeagueMetadataInformation.cs +++ b/Nhl.Api.Domain/Models/League/LeagueMetadataInformation.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.League; /// diff --git a/Nhl.Api.Domain/Models/Player/ExpressionGoalieFilterBuilder.cs b/Nhl.Api.Domain/Models/Player/ExpressionGoalieFilterBuilder.cs index 3134f0e1..83d9cc43 100644 --- a/Nhl.Api.Domain/Models/Player/ExpressionGoalieFilterBuilder.cs +++ b/Nhl.Api.Domain/Models/Player/ExpressionGoalieFilterBuilder.cs @@ -1,7 +1,7 @@ -using Nhl.Api.Common.Extensions; using System.ComponentModel; using System.Runtime.Serialization; using System.Text; +using Nhl.Api.Common.Extensions; namespace Nhl.Api.Models.Player; /// diff --git a/Nhl.Api.Domain/Models/Player/ExpressionPlayerFilterBuilder.cs b/Nhl.Api.Domain/Models/Player/ExpressionPlayerFilterBuilder.cs index 1f2a6e4b..197751b8 100644 --- a/Nhl.Api.Domain/Models/Player/ExpressionPlayerFilterBuilder.cs +++ b/Nhl.Api.Domain/Models/Player/ExpressionPlayerFilterBuilder.cs @@ -1,7 +1,7 @@ -using Nhl.Api.Common.Extensions; using System.ComponentModel; using System.Runtime.Serialization; using System.Text; +using Nhl.Api.Common.Extensions; namespace Nhl.Api.Models.Player; /// @@ -42,7 +42,29 @@ public PlayerFilterExpressionBuilder AddFilter(PlayerStatisticsFilter playerStat } /// - /// Adds a 'contains' filter to the expression filter + /// Adds a filter to the expression filter to filter by any of the returned properties + /// + /// The player statistics filter + /// The builder to continue building the expression + public PlayerFilterExpressionBuilder AddFilter(PlayerRealtimeStatisticsFilter playerRealtimeStatisticsFilter) + { + _filterExpression.Append($"{playerRealtimeStatisticsFilter.GetEnumMemberValue()}"); + return this; + } + + /// + /// Adds a filter to the expression filter to filter by any of the returned properties + /// + /// The player statistics filter + /// The builder to continue building the expression + public PlayerFilterExpressionBuilder AddFilter(PlayerTimeOnIceStatisticsFilter playerTimeOnIceStatisticsFilter) + { + _filterExpression.Append($"{playerTimeOnIceStatisticsFilter.GetEnumMemberValue()}"); + return this; + } + + /// + /// Adds a 'contains' filter to the expression filter /// /// The value to search for /// The builder to continue building the expression @@ -53,7 +75,7 @@ public PlayerFilterExpressionBuilder Contains(object value) } /// - /// Adds a 'not contains' filter to the expression filter + /// Adds a 'not contains' filter to the expression filter /// /// The value to exclude /// The builder to continue building the expression @@ -64,7 +86,7 @@ public PlayerFilterExpressionBuilder NotContains(object value) } /// - /// Adds an 'AND' logical operator to the expression filter + /// Adds an 'AND' logical operator to the expression filter /// /// The builder to continue building the expression public PlayerFilterExpressionBuilder And() @@ -74,7 +96,7 @@ public PlayerFilterExpressionBuilder And() } /// - /// Adds an 'OR' logical operator to the expression filter + /// Adds an 'OR' logical operator to the expression filter /// /// The builder to continue building the expression public PlayerFilterExpressionBuilder Or() @@ -84,7 +106,7 @@ public PlayerFilterExpressionBuilder Or() } /// - /// Adds a start group '(' to the expression filter + /// Adds a start group '(' to the expression filter /// /// The builder to continue building the expression public PlayerFilterExpressionBuilder StartGroup() @@ -94,7 +116,7 @@ public PlayerFilterExpressionBuilder StartGroup() } /// - /// Adds an end group ')' to the expression filter + /// Adds an end group ')' to the expression filter /// /// The builder to continue building the expression public PlayerFilterExpressionBuilder EndGroup() @@ -104,7 +126,7 @@ public PlayerFilterExpressionBuilder EndGroup() } /// - /// Adds an 'equal to' filter to the expression filter. + /// Adds an 'equal to' filter to the expression filter. /// /// The value to compare against. /// The builder to continue building the expression. @@ -123,7 +145,7 @@ public PlayerFilterExpressionBuilder EqualTo(object value) } /// - /// Adds a 'not equal to' filter to the expression filter + /// Adds a 'not equal to' filter to the expression filter /// /// The value to compare against. /// The builder to continue building the expression @@ -142,7 +164,7 @@ public PlayerFilterExpressionBuilder NotEqualTo(object value) } /// - /// Adds a 'greater than' filter to the expression filter + /// Adds a 'greater than' filter to the expression filter /// /// The value to compare against. /// The builder to continue building the expression @@ -153,7 +175,7 @@ public PlayerFilterExpressionBuilder GreaterThan(object value) } /// - /// Adds a 'greater than or equal to' filter to the expression filter + /// Adds a 'greater than or equal to' filter to the expression filter /// /// The value to compare against /// The builder to continue building the expression @@ -161,18 +183,18 @@ public PlayerFilterExpressionBuilder GreaterThanOrEqualTo(object value) { if (value is string) { - _filterExpression.Append($" > '{value}' "); + _filterExpression.Append($" >= '{value}' "); } else { - _filterExpression.Append($" > {value} "); + _filterExpression.Append($" >= {value} "); } return this; } /// - /// Adds a 'less than' filter to the expression filter + /// Adds a 'less than' filter to the expression filter /// /// The value to compare against /// The builder to continue building the expression @@ -192,7 +214,7 @@ public PlayerFilterExpressionBuilder LessThan(object value) } /// - /// Adds a 'less than or equal to' filter to the expression filter + /// Adds a 'less than or equal to' filter to the expression filter /// /// The value to compare against /// The builder to continue building the expression @@ -458,3 +480,366 @@ public enum PlayerStatisticsFilter [EnumMember(Value = "weight")] Weight } + +/// +/// The enumeration for the NHL player statistics information for the NHL API for realtime player statistics +/// +public enum PlayerRealtimeStatisticsFilter +{ + /// + /// Blocked shots + /// + [Description("blockedShots")] + [EnumMember(Value = "blockedShots")] + BlockedShots, + + /// + /// Blocked shots per 60 minutes + /// + [Description("blockedShotsPer60")] + [EnumMember(Value = "blockedShotsPer60")] + BlockedShotsPer60, + + /// + /// Empty net assists + /// + [Description("emptyNetAssists")] + [EnumMember(Value = "emptyNetAssists")] + EmptyNetAssists, + + /// + /// Empty net goals + /// + [Description("emptyNetGoals")] + [EnumMember(Value = "emptyNetGoals")] + EmptyNetGoals, + + /// + /// Empty net points + /// + [Description("emptyNetPoints")] + [EnumMember(Value = "emptyNetPoints")] + EmptyNetPoints, + + /// + /// First goals + /// + [Description("firstGoals")] + [EnumMember(Value = "firstGoals")] + FirstGoals, + + /// + /// Games played + /// + [Description("gamesPlayed")] + [EnumMember(Value = "gamesPlayed")] + GamesPlayed, + + /// + /// Giveaways + /// + [Description("giveaways")] + [EnumMember(Value = "giveaways")] + Giveaways, + + /// + /// Giveaways per 60 minutes + /// + [Description("giveawaysPer60")] + [EnumMember(Value = "giveawaysPer60")] + GiveawaysPer60, + + /// + /// Hits + /// + [Description("hits")] + [EnumMember(Value = "hits")] + Hits, + + /// + /// Hits per 60 minutes + /// + [Description("hitsPer60")] + [EnumMember(Value = "hitsPer60")] + HitsPer60, + + /// + /// Last name + /// + [Description("lastName")] + [EnumMember(Value = "lastName")] + LastName, + + /// + /// Missed shot crossbar + /// + [Description("missedShotCrossbar")] + [EnumMember(Value = "missedShotCrossbar")] + MissedShotCrossbar, + + /// + /// Missed shot goalpost + /// + [Description("missedShotGoalpost")] + [EnumMember(Value = "missedShotGoalpost")] + MissedShotGoalpost, + + /// + /// Missed shot over net + /// + [Description("missedShotOverNet")] + [EnumMember(Value = "missedShotOverNet")] + MissedShotOverNet, + + /// + /// Missed shot short + /// + [Description("missedShotShort")] + [EnumMember(Value = "missedShotShort")] + MissedShotShort, + + /// + /// Missed shot wide of net + /// + [Description("missedShotWideOfNet")] + [EnumMember(Value = "missedShotWideOfNet")] + MissedShotWideOfNet, + + /// + /// Missed shots + /// + [Description("missedShots")] + [EnumMember(Value = "missedShots")] + MissedShots, + + /// + /// Overtime goals + /// + [Description("otGoals")] + [EnumMember(Value = "otGoals")] + OvertimeGoals, + + /// + /// Player ID + /// + [Description("playerId")] + [EnumMember(Value = "playerId")] + PlayerId, + + /// + /// Position code + /// + [Description("positionCode")] + [EnumMember(Value = "positionCode")] + PositionCode, + + /// + /// Season ID + /// + [Description("seasonId")] + [EnumMember(Value = "seasonId")] + SeasonId, + + /// + /// Shoots/Catches + /// + [Description("shootsCatches")] + [EnumMember(Value = "shootsCatches")] + ShootsCatches, + + /// + /// Shot attempts blocked + /// + [Description("shotAttemptsBlocked")] + [EnumMember(Value = "shotAttemptsBlocked")] + ShotAttemptsBlocked, + + /// + /// Skater full name + /// + [Description("skaterFullName")] + [EnumMember(Value = "skaterFullName")] + SkaterFullName, + + /// + /// Takeaways + /// + [Description("takeaways")] + [EnumMember(Value = "takeaways")] + Takeaways, + + /// + /// Takeaways per 60 minutes + /// + [Description("takeawaysPer60")] + [EnumMember(Value = "takeawaysPer60")] + TakeawaysPer60, + + /// + /// Team abbreviations + /// + [Description("teamAbbrevs")] + [EnumMember(Value = "teamAbbrevs")] + TeamAbbreviation, + + /// + /// Time on ice per game + /// + [Description("timeOnIcePerGame")] + [EnumMember(Value = "timeOnIcePerGame")] + TimeOnIcePerGame + +} + +/// +/// The enumeration for the NHL player statistics information for the NHL API for player statistics for time on ice +/// +public enum PlayerTimeOnIceStatisticsFilter +{ + /// + /// Even time on ice + /// + [Description("evTimeOnIce")] + [EnumMember(Value = "evTimeOnIce")] + EvenTimeOnIce, + + /// + /// Even time on ice per game + /// + [Description("evTimeOnIcePerGame")] + [EnumMember(Value = "evTimeOnIcePerGame")] + EvenTimeOnIcePerGame, + + /// + /// Games played + /// + [Description("gamesPlayed")] + [EnumMember(Value = "gamesPlayed")] + GamesPlayed, + + /// + /// Last name + /// + [Description("lastName")] + [EnumMember(Value = "lastName")] + LastName, + + /// + /// Overtime time on ice + /// + [Description("otTimeOnIce")] + [EnumMember(Value = "otTimeOnIce")] + OvertimeTimeOnIce, + + /// + /// Overtime time on ice per overtime game + /// + [Description("otTimeOnIcePerOtGame")] + [EnumMember(Value = "otTimeOnIcePerOtGame")] + OvertimeTimeOnIcePerOvertimeGame, + + /// + /// Player ID + /// + [Description("playerId")] + [EnumMember(Value = "playerId")] + PlayerId, + + /// + /// Position code + /// + [Description("positionCode")] + [EnumMember(Value = "positionCode")] + PositionCode, + + /// + /// Power play time on ice + /// + [Description("ppTimeOnIce")] + [EnumMember(Value = "ppTimeOnIce")] + PowerPlayTimeOnIce, + + /// + /// Power play time on ice per game + /// + [Description("ppTimeOnIcePerGame")] + [EnumMember(Value = "ppTimeOnIcePerGame")] + PowerPlayTimeOnIcePerGame, + + /// + /// Season ID + /// + [Description("seasonId")] + [EnumMember(Value = "seasonId")] + SeasonId, + + /// + /// Short-handed time on ice + /// + [Description("shTimeOnIce")] + [EnumMember(Value = "shTimeOnIce")] + ShortHandedTimeOnIce, + + /// + /// Short-handed time on ice per game + /// + [Description("shTimeOnIcePerGame")] + [EnumMember(Value = "shTimeOnIcePerGame")] + ShortHandedTimeOnIcePerGame, + + /// + /// Shifts + /// + [Description("shifts")] + [EnumMember(Value = "shifts")] + Shifts, + + /// + /// Shifts per game + /// + [Description("shiftsPerGame")] + [EnumMember(Value = "shiftsPerGame")] + ShiftsPerGame, + + /// + /// Shoots/Catches + /// + [Description("shootsCatches")] + [EnumMember(Value = "shootsCatches")] + ShootsCatches, + + /// + /// Skater full name + /// + [Description("skaterFullName")] + [EnumMember(Value = "skaterFullName")] + SkaterFullName, + + /// + /// Team abbreviations + /// + [Description("teamAbbrevs")] + [EnumMember(Value = "teamAbbrevs")] + TeamAbbreviation, + + /// + /// Time on ice + /// + [Description("timeOnIce")] + [EnumMember(Value = "timeOnIce")] + TimeOnIce, + + /// + /// Time on ice per game + /// + [Description("timeOnIcePerGame")] + [EnumMember(Value = "timeOnIcePerGame")] + TimeOnIcePerGame, + + /// + /// Time on ice per shift + /// + [Description("timeOnIcePerShift")] + [EnumMember(Value = "timeOnIcePerShift")] + TimeOnIcePerShift +} diff --git a/Nhl.Api.Domain/Models/Player/GoalieProfile.cs b/Nhl.Api.Domain/Models/Player/GoalieProfile.cs index c31405d0..1ed547a1 100644 --- a/Nhl.Api.Domain/Models/Player/GoalieProfile.cs +++ b/Nhl.Api.Domain/Models/Player/GoalieProfile.cs @@ -1,7 +1,7 @@ -using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Globalization; +using Newtonsoft.Json; namespace Nhl.Api.Models.Player; /// diff --git a/Nhl.Api.Domain/Models/Player/PlayerData.cs b/Nhl.Api.Domain/Models/Player/PlayerData.cs index d3f90445..1b982096 100644 --- a/Nhl.Api.Domain/Models/Player/PlayerData.cs +++ b/Nhl.Api.Domain/Models/Player/PlayerData.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Player; /// diff --git a/Nhl.Api.Domain/Models/Player/PlayerProfile.cs b/Nhl.Api.Domain/Models/Player/PlayerProfile.cs index 857cd215..0cf5f3eb 100644 --- a/Nhl.Api.Domain/Models/Player/PlayerProfile.cs +++ b/Nhl.Api.Domain/Models/Player/PlayerProfile.cs @@ -1,7 +1,7 @@ -using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Globalization; +using Newtonsoft.Json; namespace Nhl.Api.Models.Player; /// diff --git a/Nhl.Api.Domain/Models/Player/PlayerShiftInformation.cs b/Nhl.Api.Domain/Models/Player/PlayerShiftInformation.cs index ee828b10..37f5f246 100644 --- a/Nhl.Api.Domain/Models/Player/PlayerShiftInformation.cs +++ b/Nhl.Api.Domain/Models/Player/PlayerShiftInformation.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Player; /// diff --git a/Nhl.Api.Domain/Models/Player/StatisticsReportType.cs b/Nhl.Api.Domain/Models/Player/StatisticsReportType.cs new file mode 100644 index 00000000..6b917680 --- /dev/null +++ b/Nhl.Api.Domain/Models/Player/StatisticsReportType.cs @@ -0,0 +1,30 @@ +using System.ComponentModel; +using System.Runtime.Serialization; + +namespace Nhl.Api.Models.Player; + +/// +/// A statistics filter for the retreival of player and goalie statistics in the NHL using Cayenne expressions +/// +public enum StatisticsReportType +{ + /// + /// Summary + /// + [Description("summary")] + [EnumMember(Value = "summary")] + Summary, + /// + /// Time on Ice + /// + [Description("timeonice")] + [EnumMember(Value = "timeonice")] + TimeOnIce, + /// + /// Real Time + /// + [Description("realtime")] + [EnumMember(Value = "realtime")] + Realtime + +} diff --git a/Nhl.Api.Domain/Models/Player/TeamProspects.cs b/Nhl.Api.Domain/Models/Player/TeamProspects.cs index 2bc5ea50..f6af36f1 100644 --- a/Nhl.Api.Domain/Models/Player/TeamProspects.cs +++ b/Nhl.Api.Domain/Models/Player/TeamProspects.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; +using System.Collections.Generic; +using Newtonsoft.Json; using Nhl.Api.Models.Team; -using System.Collections.Generic; namespace Nhl.Api.Models.Player; /// diff --git a/Nhl.Api.Domain/Models/Schedule/LeagueSchedule.cs b/Nhl.Api.Domain/Models/Schedule/LeagueSchedule.cs index 2fb109ec..a2f26947 100644 --- a/Nhl.Api.Domain/Models/Schedule/LeagueSchedule.cs +++ b/Nhl.Api.Domain/Models/Schedule/LeagueSchedule.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Schedule; /// diff --git a/Nhl.Api.Domain/Models/Schedule/LeagueScheduleCalendar.cs b/Nhl.Api.Domain/Models/Schedule/LeagueScheduleCalendar.cs index be0126d2..483fb351 100644 --- a/Nhl.Api.Domain/Models/Schedule/LeagueScheduleCalendar.cs +++ b/Nhl.Api.Domain/Models/Schedule/LeagueScheduleCalendar.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Schedule; /// diff --git a/Nhl.Api.Domain/Models/Schedule/TeamSchedule.cs b/Nhl.Api.Domain/Models/Schedule/TeamSchedule.cs index 71b408b0..223e0ea8 100644 --- a/Nhl.Api.Domain/Models/Schedule/TeamSchedule.cs +++ b/Nhl.Api.Domain/Models/Schedule/TeamSchedule.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Schedule; /// diff --git a/Nhl.Api.Domain/Models/Schedule/TeamSeasonSchedule.cs b/Nhl.Api.Domain/Models/Schedule/TeamSeasonSchedule.cs index d75c77e3..0b7d0e52 100644 --- a/Nhl.Api.Domain/Models/Schedule/TeamSeasonSchedule.cs +++ b/Nhl.Api.Domain/Models/Schedule/TeamSeasonSchedule.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Schedule; /// diff --git a/Nhl.Api.Domain/Models/Schedule/TeamWeekSchedule.cs b/Nhl.Api.Domain/Models/Schedule/TeamWeekSchedule.cs index 9bdf34e9..490656dd 100644 --- a/Nhl.Api.Domain/Models/Schedule/TeamWeekSchedule.cs +++ b/Nhl.Api.Domain/Models/Schedule/TeamWeekSchedule.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Schedule; /// diff --git a/Nhl.Api.Domain/Models/Season/LeagueStandingsSeasonInformation.cs b/Nhl.Api.Domain/Models/Season/LeagueStandingsSeasonInformation.cs index 983beda4..c2956441 100644 --- a/Nhl.Api.Domain/Models/Season/LeagueStandingsSeasonInformation.cs +++ b/Nhl.Api.Domain/Models/Season/LeagueStandingsSeasonInformation.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Season; /// diff --git a/Nhl.Api.Domain/Models/Season/TeamStatisticsSeason.cs b/Nhl.Api.Domain/Models/Season/TeamStatisticsSeason.cs index bbd35ec9..b64478dc 100644 --- a/Nhl.Api.Domain/Models/Season/TeamStatisticsSeason.cs +++ b/Nhl.Api.Domain/Models/Season/TeamStatisticsSeason.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Season; /// diff --git a/Nhl.Api.Domain/Models/Standing/LeagueStanding.cs b/Nhl.Api.Domain/Models/Standing/LeagueStanding.cs index 69b8a7a8..0d734651 100644 --- a/Nhl.Api.Domain/Models/Standing/LeagueStanding.cs +++ b/Nhl.Api.Domain/Models/Standing/LeagueStanding.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; +using System.Collections.Generic; +using Newtonsoft.Json; using Nhl.Api.Models.Team; -using System.Collections.Generic; namespace Nhl.Api.Models.Standing; /// diff --git a/Nhl.Api.Domain/Models/Statistics/GoalieStatisticsFilterResult.cs b/Nhl.Api.Domain/Models/Statistics/GoalieStatisticsFilterResult.cs index ba405bc0..fe76ea0c 100644 --- a/Nhl.Api.Domain/Models/Statistics/GoalieStatisticsFilterResult.cs +++ b/Nhl.Api.Domain/Models/Statistics/GoalieStatisticsFilterResult.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Statistics; /// @@ -91,10 +91,10 @@ public class GoalieStatisticsResult /// /// The number of losses in overtime by the NHL goalie in the season
- /// Example: 2 + /// Example: 2 or null ///
[JsonProperty("otLosses")] - public int OvertimeLosses { get; set; } + public int? OvertimeLosses { get; set; } /// /// The total number of penalty minutes served by the NHL goalie in the season
@@ -119,17 +119,17 @@ public class GoalieStatisticsResult /// /// The percentage of shots saved by the NHL goalie in the season
- /// Example: 0.91711 + /// Example: 0.91711 or null ///
[JsonProperty("savePct")] - public double SavePercentage { get; set; } + public decimal? SavePercentage { get; set; } /// /// The total number of saves made by the NHL goalie in the season
- /// Example: 102 + /// Example: 102 or null ///
[JsonProperty("saves")] - public int Saves { get; set; } + public int? Saves { get; set; } /// /// The identifier of the season for which the statistics are recorded
@@ -147,10 +147,10 @@ public class GoalieStatisticsResult /// /// The total number of shots faced by the NHL goalie in the season
- /// Example: 1342 + /// Example: 1342 or null ///
[JsonProperty("shotsAgainst")] - public int ShotsAgainst { get; set; } + public int? ShotsAgainst { get; set; } /// /// The total number of shutouts recorded by the NHL goalie in the season
diff --git a/Nhl.Api.Domain/Models/Statistics/GoalieStatisticsLeaders.cs b/Nhl.Api.Domain/Models/Statistics/GoalieStatisticsLeaders.cs index 4b32477e..9414cafa 100644 --- a/Nhl.Api.Domain/Models/Statistics/GoalieStatisticsLeaders.cs +++ b/Nhl.Api.Domain/Models/Statistics/GoalieStatisticsLeaders.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Statistics; /// diff --git a/Nhl.Api.Domain/Models/Statistics/PlayerRealtimeStatisticsFilterResult.cs b/Nhl.Api.Domain/Models/Statistics/PlayerRealtimeStatisticsFilterResult.cs new file mode 100644 index 00000000..eac58c6c --- /dev/null +++ b/Nhl.Api.Domain/Models/Statistics/PlayerRealtimeStatisticsFilterResult.cs @@ -0,0 +1,203 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nhl.Api.Models.Statistics; +/// +/// The returned results of the NHL real time player statistics with search filters +/// +public class PlayerRealtimeStatisticsFilterResult +{ + /// + /// The NHL player statistics result by summary of statistics for a player and season + /// + [JsonProperty("data")] + public List PlayerRealtimeStatisticsResults { get; set; } + + /// + /// The total number of results based on the search criteria
+ /// Example: 4 + ///
+ [JsonProperty("total")] + public int Total { get; set; } +} + +/// +/// The NHL player statistics result by summary of statistics for a player and season +/// +public class PlayerRealtimeStatisticsResult +{ + /// + /// Number of blocked shots. + /// + [JsonProperty("blockedShots")] + public int? BlockedShots { get; set; } + + /// + /// Blocked shots per 60 minutes. + /// + [JsonProperty("blockedShotsPer60")] + public decimal? BlockedShotsPer60 { get; set; } + + /// + /// Number of empty net assists. + /// + [JsonProperty("emptyNetAssists")] + public int? EmptyNetAssists { get; set; } + + /// + /// Number of empty net goals. + /// + [JsonProperty("emptyNetGoals")] + public int? EmptyNetGoals { get; set; } + + /// + /// Number of empty net points. + /// + [JsonProperty("emptyNetPoints")] + public int? EmptyNetPoints { get; set; } + + /// + /// Number of first goals. + /// + [JsonProperty("firstGoals")] + public int? FirstGoals { get; set; } + + /// + /// Number of games played. + /// + [JsonProperty("gamesPlayed")] + public int? GamesPlayed { get; set; } + + /// + /// Number of giveaways. + /// + [JsonProperty("giveaways")] + public int? Giveaways { get; set; } + + /// + /// Giveaways per 60 minutes. + /// + [JsonProperty("giveawaysPer60")] + public double GiveawaysPer60 { get; set; } + + /// + /// Number of hits. + /// + [JsonProperty("hits")] + public int? Hits { get; set; } + + /// + /// Hits per 60 minutes. + /// + [JsonProperty("hitsPer60")] + public double HitsPer60 { get; set; } + + /// + /// Player's last name. + /// + [JsonProperty("lastName")] + public string LastName { get; set; } + + /// + /// Number of missed shots that hit the crossbar. + /// + [JsonProperty("missedShotCrossbar")] + public int? MissedShotCrossbar { get; set; } + + /// + /// Number of missed shots that hit the goalpost. + /// + [JsonProperty("missedShotGoalpost")] + public int? MissedShotGoalpost { get; set; } + + /// + /// Number of missed shots that went over the net. + /// + [JsonProperty("missedShotOverNet")] + public int? MissedShotOverNet { get; set; } + + /// + /// Number of missed shots that were short. + /// + [JsonProperty("missedShotShort")] + public int? MissedShotShort { get; set; } + + /// + /// Number of missed shots that went wide of the net. + /// + [JsonProperty("missedShotWideOfNet")] + public int? MissedShotWideOfNet { get; set; } + + /// + /// Total number of missed shots. + /// + [JsonProperty("missedShots")] + public int? MissedShots { get; set; } + + /// + /// Number of overtime goals. + /// + [JsonProperty("otGoals")] + public int? OvertimeGoals { get; set; } + + /// + /// Player's ID. + /// + [JsonProperty("playerId")] + public int? PlayerId { get; set; } + + /// + /// Player's position code. + /// + [JsonProperty("positionCode")] + public string PositionCode { get; set; } + + /// + /// Season ID. + /// + [JsonProperty("seasonId")] + public int? SeasonId { get; set; } + + /// + /// Player's shooting or catching hand. + /// + [JsonProperty("shootsCatches")] + public string ShootsCatches { get; set; } + + /// + /// Number of shot attempts that were blocked. + /// + [JsonProperty("shotAttemptsBlocked")] + public int? ShotAttemptsBlocked { get; set; } + + /// + /// Player's full name. + /// + [JsonProperty("skaterFullName")] + public string SkaterFullName { get; set; } + + /// + /// Number of takeaways. + /// + [JsonProperty("takeaways")] + public int? Takeaways { get; set; } + + /// + /// Takeaways per 60 minutes. + /// + [JsonProperty("takeawaysPer60")] + public double TakeawaysPer60 { get; set; } + + /// + /// Team abbreviation. + /// + [JsonProperty("teamAbbrevs")] + public string TeamAbbrevs { get; set; } + + /// + /// Time on ice per game in minutes. + /// + [JsonProperty("timeOnIcePerGame")] + public decimal? TimeOnIcePerGame { get; set; } + +} diff --git a/Nhl.Api.Domain/Models/Statistics/PlayerStatisticLeaders.cs b/Nhl.Api.Domain/Models/Statistics/PlayerStatisticLeaders.cs index 68482c35..468fb858 100644 --- a/Nhl.Api.Domain/Models/Statistics/PlayerStatisticLeaders.cs +++ b/Nhl.Api.Domain/Models/Statistics/PlayerStatisticLeaders.cs @@ -1,7 +1,7 @@ -using Newtonsoft.Json; -using Nhl.Api.Models.Player; -using System; +using System; using System.Collections.Generic; +using Newtonsoft.Json; +using Nhl.Api.Models.Player; namespace Nhl.Api.Models.Statistics; /// diff --git a/Nhl.Api.Domain/Models/Statistics/PlayerStatisticsFilterResult.cs b/Nhl.Api.Domain/Models/Statistics/PlayerStatisticsFilterResult.cs index 064a2eee..52d84767 100644 --- a/Nhl.Api.Domain/Models/Statistics/PlayerStatisticsFilterResult.cs +++ b/Nhl.Api.Domain/Models/Statistics/PlayerStatisticsFilterResult.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; using System.Collections.Generic; +using Newtonsoft.Json; namespace Nhl.Api.Models.Statistics; /// @@ -35,17 +35,17 @@ public class PlayerStatisticsResult /// /// The NHL player even strength goals
- /// Example: 5 + /// Example: 5 or null ///
[JsonProperty("evGoals")] - public int EvenStrengthGoals { get; set; } + public int? EvenStrengthGoals { get; set; } /// /// The NHL player even strength points
- /// Example: 6 + /// Example: 6 or null ///
[JsonProperty("evPoints")] - public int EvenStrengthPoints { get; set; } + public int? EvenStrengthPoints { get; set; } /// /// The NHL player faceoff win percentage
@@ -105,10 +105,10 @@ public class PlayerStatisticsResult /// /// The NHL player plus minus
- /// Example: 5 + /// Example: 5 or null ///
[JsonProperty("plusMinus")] - public int PlusMinus { get; set; } + public int? PlusMinus { get; set; } /// /// The NHL player points
@@ -133,17 +133,17 @@ public class PlayerStatisticsResult /// /// The NHL player power play goals
- /// Example: 3 + /// Example: 3 or null ///
[JsonProperty("ppGoals")] - public int PowerPlayGoals { get; set; } + public int? PowerPlayGoals { get; set; } /// /// The NHL player power play points
- /// Example: 4 + /// Example: 4 or null ///
[JsonProperty("ppPoints")] - public int PowerPlayPoints { get; set; } + public int? PowerPlayPoints { get; set; } /// /// The NHL player season identifier
@@ -154,21 +154,21 @@ public class PlayerStatisticsResult /// /// The NHL player short handed goals
- /// Example: 1 + /// Example: 1 or null ///
[JsonProperty("shGoals")] - public int ShortHandedGoals { get; set; } + public int? ShortHandedGoals { get; set; } /// /// The NHL player short handed points
- /// Example: 2 + /// Example: 2 or null ///
[JsonProperty("shPoints")] - public int ShortHandedPoints { get; set; } + public int? ShortHandedPoints { get; set; } /// /// The NHL player shooting percentage
- /// Example: 0.1234561 + /// Example: 0.1234561 or null ///
[JsonProperty("shootingPct")] public decimal? ShootingPercentage { get; set; } @@ -207,4 +207,6 @@ public class PlayerStatisticsResult ///
[JsonProperty("timeOnIcePerGame")] public decimal? TimeOnIcePerGame { get; set; } + + } diff --git a/Nhl.Api.Domain/Models/Statistics/PlayerTimeOnIceStatisticsFilterResult.cs b/Nhl.Api.Domain/Models/Statistics/PlayerTimeOnIceStatisticsFilterResult.cs new file mode 100644 index 00000000..06c5ccfc --- /dev/null +++ b/Nhl.Api.Domain/Models/Statistics/PlayerTimeOnIceStatisticsFilterResult.cs @@ -0,0 +1,155 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nhl.Api.Models.Statistics; +/// +/// The returned results of the NHL real time player statistics with search filters +/// +public class PlayerTimeOnIceStatisticsFilterResult +{ + /// + /// The NHL player statistics result by summary of statistics for a player and season + /// + [JsonProperty("data")] + public List PlayerTimeOnIceStatisticsResults { get; set; } + + /// + /// The total number of results based on the search criteria
+ /// Example: 4 + ///
+ [JsonProperty("total")] + public int Total { get; set; } +} + +/// +/// The NHL player statistics result by summary of statistics for a player and season +/// +public class PlayerTimeOnIceStatisticsResult +{ + /// + /// Even strength time on ice in seconds. + /// + [JsonProperty("evTimeOnIce")] + public int EvTimeOnIce { get; set; } + + /// + /// Even strength time on ice per game in seconds. + /// + [JsonProperty("evTimeOnIcePerGame")] + public double EvTimeOnIcePerGame { get; set; } + + /// + /// Number of games played. + /// + [JsonProperty("gamesPlayed")] + public int GamesPlayed { get; set; } + + /// + /// Player's last name. + /// + [JsonProperty("lastName")] + public string LastName { get; set; } + + /// + /// Overtime time on ice in seconds. + /// + [JsonProperty("otTimeOnIce")] + public int OtTimeOnIce { get; set; } + + /// + /// Overtime time on ice per overtime game in seconds. + /// + [JsonProperty("otTimeOnIcePerOtGame")] + public double OtTimeOnIcePerOtGame { get; set; } + + /// + /// Player's ID. + /// + [JsonProperty("playerId")] + public int PlayerId { get; set; } + + /// + /// Player's position code. + /// + [JsonProperty("positionCode")] + public string PositionCode { get; set; } + + /// + /// Power play time on ice in seconds. + /// + [JsonProperty("ppTimeOnIce")] + public int PpTimeOnIce { get; set; } + + /// + /// Power play time on ice per game in seconds. + /// + [JsonProperty("ppTimeOnIcePerGame")] + public double PpTimeOnIcePerGame { get; set; } + + /// + /// Season ID. + /// + [JsonProperty("seasonId")] + public int SeasonId { get; set; } + + /// + /// Short-handed time on ice in seconds. + /// + [JsonProperty("shTimeOnIce")] + public int ShTimeOnIce { get; set; } + + /// + /// Short-handed time on ice per game in seconds. + /// + [JsonProperty("shTimeOnIcePerGame")] + public double ShTimeOnIcePerGame { get; set; } + + /// + /// Number of shifts. + /// + [JsonProperty("shifts")] + public int Shifts { get; set; } + + /// + /// Shifts per game. + /// + [JsonProperty("shiftsPerGame")] + public double ShiftsPerGame { get; set; } + + /// + /// Player's shooting or catching hand. + /// + [JsonProperty("shootsCatches")] + public string ShootsCatches { get; set; } + + /// + /// Player's full name. + /// + [JsonProperty("skaterFullName")] + public string SkaterFullName { get; set; } + + /// + /// Team abbreviation. + /// + [JsonProperty("teamAbbrevs")] + public string TeamAbbrevs { get; set; } + + /// + /// Total time on ice in seconds. + /// + [JsonProperty("timeOnIce")] + public int TimeOnIce { get; set; } + + /// + /// Time on ice per game in seconds. + /// + [JsonProperty("timeOnIcePerGame")] + public decimal? TimeOnIcePerGame { get; set; } + + /// + /// Time on ice per shift in seconds. + /// + [JsonProperty("timeOnIcePerShift")] + public decimal? TimeOnIcePerShift { get; set; } + +} diff --git a/Nhl.Api.Domain/Models/Team/TeamCodes.cs b/Nhl.Api.Domain/Models/Team/TeamCodes.cs index 2be0f0eb..5555d4ef 100644 --- a/Nhl.Api.Domain/Models/Team/TeamCodes.cs +++ b/Nhl.Api.Domain/Models/Team/TeamCodes.cs @@ -1,4 +1,4 @@ -namespace Nhl.Api.Models.Team; +namespace Nhl.Api.Models.Team; /// /// All of the NHL team 3 character identifiers @@ -238,4 +238,8 @@ public static class TeamCodes /// Washington Capitals /// public const string WashingtonCapitals = "WSH"; + /// + /// Utah Hockey Club + /// + public const string UtahHockeyClub = "UTA"; } diff --git a/Nhl.Api.Domain/Models/Team/TeamSeasonRoster.cs b/Nhl.Api.Domain/Models/Team/TeamSeasonRoster.cs index fc896e6b..a06e887b 100644 --- a/Nhl.Api.Domain/Models/Team/TeamSeasonRoster.cs +++ b/Nhl.Api.Domain/Models/Team/TeamSeasonRoster.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; +using System.Collections.Generic; +using Newtonsoft.Json; using Nhl.Api.Models.Player; -using System.Collections.Generic; namespace Nhl.Api.Models.Team; /// diff --git a/Nhl.Api.Domain/Models/Team/TeamSeasonStatistics.cs b/Nhl.Api.Domain/Models/Team/TeamSeasonStatistics.cs index b654d219..0bc9fc2c 100644 --- a/Nhl.Api.Domain/Models/Team/TeamSeasonStatistics.cs +++ b/Nhl.Api.Domain/Models/Team/TeamSeasonStatistics.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; +using System.Collections.Generic; +using Newtonsoft.Json; using Nhl.Api.Models.Player; -using System.Collections.Generic; namespace Nhl.Api.Models.Team; /// diff --git a/Nhl.Api.Domain/Nhl.Api.Domain.csproj b/Nhl.Api.Domain/Nhl.Api.Domain.csproj index 2c8a4605..58542fca 100644 --- a/Nhl.Api.Domain/Nhl.Api.Domain.csproj +++ b/Nhl.Api.Domain/Nhl.Api.Domain.csproj @@ -1,7 +1,7 @@ - 3.4.2 + 3.5.0 net8.0 true enable diff --git a/Nhl.Api.Domain/Services/NhlTeamService.cs b/Nhl.Api.Domain/Services/NhlTeamService.cs index 0c715cbd..5ff19525 100644 --- a/Nhl.Api.Domain/Services/NhlTeamService.cs +++ b/Nhl.Api.Domain/Services/NhlTeamService.cs @@ -1,10 +1,10 @@ -using Nhl.Api.Common.Extensions; -using Nhl.Api.Common.Helpers; -using Nhl.Api.Models.Enumerations.Team; -using Nhl.Api.Models.Team; using System; using System.Collections.Generic; using System.Linq; +using Nhl.Api.Common.Extensions; +using Nhl.Api.Common.Helpers; +using Nhl.Api.Models.Enumerations.Team; +using Nhl.Api.Models.Team; namespace Nhl.Api.Services; /// @@ -17,28 +17,28 @@ public interface INhlTeamService /// /// The NHL team logo type, specifying which the NHL team logo, Example: Dark /// The NHL team logo color identifier, Example: dark - public string GetTeamLogoColorIdentifier(TeamLogoType teamLogoType); + public string? GetTeamLogoColorIdentifier(TeamLogoType teamLogoType); /// /// Returns the NHL team code identifier by the team id /// /// The NHL team identifier, specifying which the NHL team, Example: 55 - Seattle Kraken /// The 3 letter code for the NHL team, Example: TOR - Toronto Maple Leafs - public string GetTeamCodeIdentifierByTeamId(int teamId); + public string? GetTeamCodeIdentifierByTeamId(int teamId); /// /// Returns the NHL team code identifier by the team abbreviation /// /// The NHL team abbreviation, specifying which the NHL team, Example: TOR - Toronto Maple Leafs /// The NHL team code for the NHL team, Example: TOR - public string GetTeamCodeIdentifierByTeamAbbreviation(string teamAbbreviation); + public string? GetTeamCodeIdentifierByTeamAbbreviation(string teamAbbreviation); /// /// Returns the NHL team code identifier by the team enumeration /// /// The NHL team enumeration, specifying which the NHL team, Example: Toronto Maple Leafs - 10 /// The NHL team code for the NHL team, Example: TOR - public string GetTeamCodeIdentifierByTeamEnumeration(TeamEnum teamEnum); + public string? GetTeamCodeIdentifierByTeamEnumeration(TeamEnum teamEnum); /// /// Returns the NHL team code identifier by the team enumerations @@ -52,7 +52,7 @@ public interface INhlTeamService /// /// The NHL team name, Example: Vancouver Canucks /// The NHL team code for the NHL team, Example: TOR - public string GetTeamCodeIdentifierByTeamName(string teamName); + public string? GetTeamCodeIdentifierByTeamName(string teamName); } @@ -67,7 +67,7 @@ public class NhlTeamService : INhlTeamService /// /// The NHL team logo type, specifying which the NHL team logo, Example: Dark /// The NHL team logo color identifier, Example: dark - public string GetTeamLogoColorIdentifier(TeamLogoType teamLogoType) => teamLogoType switch + public string? GetTeamLogoColorIdentifier(TeamLogoType teamLogoType) => teamLogoType switch { TeamLogoType.Dark => "dark", TeamLogoType.Light => "light", @@ -79,7 +79,7 @@ public class NhlTeamService : INhlTeamService /// /// The NHL team identifier, specifying which the NHL team, Example: 55 - Seattle Kraken /// The 3 letter code for the NHL team, Example: TOR - Toronto Maple Leafs - public string GetTeamCodeIdentifierByTeamId(int teamId) => teamId switch + public string? GetTeamCodeIdentifierByTeamId(int teamId) => teamId switch { (int)TeamEnum.AnaheimDucks => TeamCodes.MightyDucksofAnaheimAnaheimDucks, (int)TeamEnum.ArizonaCoyotes => TeamCodes.ArizonaCoyotes, @@ -113,6 +113,7 @@ public class NhlTeamService : INhlTeamService (int)TeamEnum.VegasGoldenKnights => TeamCodes.VegasGoldenKnights, (int)TeamEnum.WashingtonCapitals => TeamCodes.WashingtonCapitals, (int)TeamEnum.WinnipegJets => TeamCodes.WinnipegJets, + (int)TeamEnum.UtahHockeyClub => TeamCodes.UtahHockeyClub, _ => null, }; @@ -121,7 +122,7 @@ public class NhlTeamService : INhlTeamService ///
/// The NHL team abbreviation, specifying which the NHL team, Example: TOR - Toronto Maple Leafs /// The NHL team code for the NHL team, Example: TOR - public string GetTeamCodeIdentifierByTeamAbbreviation(string teamAbbreviation) => teamAbbreviation switch + public string? GetTeamCodeIdentifierByTeamAbbreviation(string teamAbbreviation) => teamAbbreviation switch { TeamCodes.MightyDucksofAnaheimAnaheimDucks => TeamCodes.MightyDucksofAnaheimAnaheimDucks, TeamCodes.ArizonaCoyotes => TeamCodes.ArizonaCoyotes, @@ -157,6 +158,7 @@ public class NhlTeamService : INhlTeamService TeamCodes.VegasGoldenKnights => TeamCodes.VegasGoldenKnights, TeamCodes.WashingtonCapitals => TeamCodes.WashingtonCapitals, TeamCodes.WinnipegJets => TeamCodes.WinnipegJets, + TeamCodes.UtahHockeyClub => TeamCodes.UtahHockeyClub, _ => null, }; @@ -166,7 +168,7 @@ public class NhlTeamService : INhlTeamService ///
/// The NHL team enumeration, specifying which the NHL team, Example: Toronto Maple Leafs - 10 /// The NHL team code for the NHL team, Example: TOR - public string GetTeamCodeIdentifierByTeamEnumeration(TeamEnum teamEnum) => teamEnum switch + public string? GetTeamCodeIdentifierByTeamEnumeration(TeamEnum teamEnum) => teamEnum switch { TeamEnum.NewJerseyDevils => TeamCodes.NewJerseyDevils, TeamEnum.NewYorkIslanders => TeamCodes.NewYorkIslanders, @@ -200,6 +202,7 @@ public class NhlTeamService : INhlTeamService TeamEnum.ArizonaCoyotes => TeamCodes.ArizonaCoyotes, TeamEnum.VegasGoldenKnights => TeamCodes.VegasGoldenKnights, TeamEnum.SeattleKraken => TeamCodes.SeattleKraken, + TeamEnum.UtahHockeyClub => TeamCodes.UtahHockeyClub, _ => null, }; @@ -225,7 +228,7 @@ public List GetTeamCodeIdentifierByTeamEnumerations(List teamE ///
/// The NHL team name, Example: Vancouver Canucks /// The NHL team code for the NHL team, Example: TOR - public string GetTeamCodeIdentifierByTeamName(string teamName) => teamName.ReplaceNonAsciiWithAscii() switch + public string? GetTeamCodeIdentifierByTeamName(string teamName) => teamName.ReplaceNonAsciiWithAscii() switch { TeamNames.AnaheimDucks => TeamCodes.MightyDucksofAnaheimAnaheimDucks, TeamNames.ArizonaCoyotes => TeamCodes.ArizonaCoyotes, @@ -259,6 +262,7 @@ public List GetTeamCodeIdentifierByTeamEnumerations(List teamE TeamNames.VegasGoldenKnights => TeamCodes.VegasGoldenKnights, TeamNames.WashingtonCapitals => TeamCodes.WashingtonCapitals, TeamNames.WinnipegJets => TeamCodes.WinnipegJets, - _ => throw new ArgumentException($"Unknown NHL team: {teamName}", nameof(teamName)), + TeamNames.UtahHockeyClub => TeamCodes.UtahHockeyClub, + _ => null }; -} +}; diff --git a/Nhl.Api.Tests/GameTests.cs b/Nhl.Api.Tests/GameTests.cs index 67fa5484..5800e273 100644 --- a/Nhl.Api.Tests/GameTests.cs +++ b/Nhl.Api.Tests/GameTests.cs @@ -1,6 +1,6 @@ -using Nhl.Api.Common.Http; using System.Linq; using System.Text.RegularExpressions; +using Nhl.Api.Common.Http; namespace Nhl.Api.Tests; diff --git a/Nhl.Api.Tests/GlobalUsings.cs b/Nhl.Api.Tests/GlobalUsings.cs index 17080eeb..b6413c88 100644 --- a/Nhl.Api.Tests/GlobalUsings.cs +++ b/Nhl.Api.Tests/GlobalUsings.cs @@ -1,9 +1,8 @@ -global using Microsoft.VisualStudio.TestTools.UnitTesting; -global using Nhl.Api.Tests.Helpers.Attributes; -global using System; +global using System; global using System.Collections.Generic; global using System.IO; global using System.Text; global using System.Threading.Tasks; - +global using Microsoft.VisualStudio.TestTools.UnitTesting; global using Nhl.Api.Models.Enumerations.Player; +global using Nhl.Api.Tests.Helpers.Attributes; diff --git a/Nhl.Api.Tests/Helpers/Attributes/TestMethodWithRetryAttribute.cs b/Nhl.Api.Tests/Helpers/Attributes/TestMethodWithRetryAttribute.cs index 0ac9107a..8cd14d85 100644 --- a/Nhl.Api.Tests/Helpers/Attributes/TestMethodWithRetryAttribute.cs +++ b/Nhl.Api.Tests/Helpers/Attributes/TestMethodWithRetryAttribute.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading; namespace Nhl.Api.Tests.Helpers.Attributes; @@ -16,19 +16,36 @@ public class TestMethodWithRetryAttribute : TestMethodAttribute /// /// A delay time between each test execution retry attempt /// - public int RetryDelayInSeconds { get; set; } = 0; + public int RetryDelayInSeconds { get; set; } = 1; + + /// + /// The backoff coefficient to apply to the retry delay + /// + public decimal BackoffCoefficent { get; set; } = 1.0m; public override TestResult[] Execute(ITestMethod testMethod) { - var count = RetryCount; - var backOffDelay = RetryDelayInSeconds; + var count = this.RetryCount; + var backOffDelay = this.RetryDelayInSeconds; + var backOffWithCoefficient = (int)(backOffDelay * this.BackoffCoefficent); + const int oneThousandMilliseconds = 1000; TestResult[] result = null; while (count > 0) { try { - Thread.Sleep(backOffDelay * 1000); + if (this.BackoffCoefficent > 1.0m) + { + backOffWithCoefficient = (int)(backOffDelay * this.BackoffCoefficent); + this.BackoffCoefficent *= this.BackoffCoefficent; + Thread.Sleep(backOffWithCoefficient * oneThousandMilliseconds); + } + else + { + Thread.Sleep(backOffDelay * oneThousandMilliseconds); + } + result = base.Execute(testMethod); if (result.Any(r => r.TestFailureException != null)) { diff --git a/Nhl.Api.Tests/LeagueTests.cs b/Nhl.Api.Tests/LeagueTests.cs index 91afa85c..4d48e3f4 100644 --- a/Nhl.Api.Tests/LeagueTests.cs +++ b/Nhl.Api.Tests/LeagueTests.cs @@ -1,8 +1,8 @@ +using System.Linq; using Nhl.Api.Enumerations.Game; using Nhl.Api.Models.Enumerations.Team; using Nhl.Api.Models.Season; using Nhl.Api.Models.Team; -using System.Linq; namespace Nhl.Api.Tests; [TestClass] @@ -356,7 +356,6 @@ public async Task GetTeamStatisticsBySeasonAndGameTypeAsync_Return_Valid_Informa [DataRow(22, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(25, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(26, SeasonYear.season20232024, GameType.RegularSeason)] - [DataRow(27, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(28, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(29, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(30, SeasonYear.season20232024, GameType.RegularSeason)] @@ -369,15 +368,13 @@ public async Task GetTeamStatisticsBySeasonAndGameTypeAsync_Return_Valid_Informa [DataRow(8, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(9, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(10, SeasonYear.season20232024, GameType.RegularSeason)] - [DataRow(11, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(13, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(14, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(15, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(17, SeasonYear.season20232024, GameType.RegularSeason)] - [DataRow(50, SeasonYear.season20232024, GameType.RegularSeason)] - [DataRow(51, SeasonYear.season20232024, GameType.RegularSeason)] [DataRow(55, SeasonYear.season20232024, GameType.RegularSeason)] - public async Task GetTeamStatisticsBySeasonAndGameTypeAsync_Return_Valid_Information(int teamId, string seasonYear, GameType gameType) + [DataRow(28, SeasonYear.season20232024, GameType.RegularSeason)] + public async Task GetTeamStatisticsBySeasonAndGameTypeAsync_Return_Valid_Information_With_TeamId(int teamId, string seasonYear, GameType gameType) { // Arrange await using var nhlApi = new NhlApi(); diff --git a/Nhl.Api.Tests/Nhl.Api.Tests.csproj b/Nhl.Api.Tests/Nhl.Api.Tests.csproj index b2c27b59..bea10c9a 100644 --- a/Nhl.Api.Tests/Nhl.Api.Tests.csproj +++ b/Nhl.Api.Tests/Nhl.Api.Tests.csproj @@ -1,7 +1,7 @@  - 3.4.2 + 3.5.0 net8.0 false true diff --git a/Nhl.Api.Tests/NhlApiAsyncHelperTests.cs b/Nhl.Api.Tests/NhlApiAsyncHelperTests.cs index 542b31a1..adab79d4 100644 --- a/Nhl.Api.Tests/NhlApiAsyncHelperTests.cs +++ b/Nhl.Api.Tests/NhlApiAsyncHelperTests.cs @@ -1,6 +1,6 @@ -using Nhl.Api.Common.Services; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Linq; +using Nhl.Api.Common.Services; namespace Nhl.Api.Tests; [TestClass] diff --git a/Nhl.Api.Tests/PlayerTests.cs b/Nhl.Api.Tests/PlayerTests.cs index 25f6e620..78db2432 100644 --- a/Nhl.Api.Tests/PlayerTests.cs +++ b/Nhl.Api.Tests/PlayerTests.cs @@ -1,7 +1,7 @@ +using System.Linq; using Newtonsoft.Json; using Nhl.Api.Enumerations.Game; using Nhl.Api.Models.Season; -using System.Linq; namespace Nhl.Api.Tests; [TestClass] diff --git a/Nhl.Api.Tests/ProjectStructureTests.cs b/Nhl.Api.Tests/ProjectStructureTests.cs index 657fcfd6..4127181c 100644 --- a/Nhl.Api.Tests/ProjectStructureTests.cs +++ b/Nhl.Api.Tests/ProjectStructureTests.cs @@ -1,8 +1,8 @@ -using Microsoft.Build.Locator; +using System.Linq; +using Microsoft.Build.Locator; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.MSBuild; -using System.Linq; namespace Nhl.Api.Tests; [TestClass] @@ -49,7 +49,7 @@ public void ValidateProjectStructure_Should_Never_Have_Domain_In_Namespace() { var errors = new StringBuilder(); - var getSourceCSharpFiles = RootDirectoryFolder.GetFiles("*.cs", SearchOption.AllDirectories); + var getSourceCSharpFiles = this.RootDirectoryFolder.GetFiles("*.cs", SearchOption.AllDirectories); foreach (var sourceCSharpFile in getSourceCSharpFiles) { if (sourceCSharpFile.FullName.Contains("Tests")) diff --git a/Nhl.Api.Tests/StatisticsTests.cs b/Nhl.Api.Tests/StatisticsTests.cs index acfe3c2c..9a86c3e7 100644 --- a/Nhl.Api.Tests/StatisticsTests.cs +++ b/Nhl.Api.Tests/StatisticsTests.cs @@ -1,3 +1,6 @@ +using System.Collections.Concurrent; +using System.Linq; +using System.Threading; using Newtonsoft.Json; using Nhl.Api.Enumerations.Game; using Nhl.Api.Enumerations.Statistic; @@ -5,9 +8,6 @@ using Nhl.Api.Models.Player; using Nhl.Api.Models.Season; using Nhl.Api.Models.Team; -using System.Collections.Concurrent; -using System.Linq; -using System.Threading; namespace Nhl.Api.Tests; [TestClass] @@ -452,7 +452,7 @@ public async Task GetPlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Result var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, expression); - // Act + // Assert Assert.IsNotNull(expression); Assert.IsNotNull(result); Assert.IsTrue(result.Total >= 9); @@ -484,7 +484,7 @@ public async Task GetPlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Result var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season19992000, expression); - // Act + // Assert Assert.IsNotNull(expression); Assert.IsNotNull(result); Assert.IsTrue(result.Total >= 8); @@ -508,7 +508,7 @@ public async Task GetPlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Result var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20102011, expression); - // Act + // Assert Assert.IsNotNull(expression); Assert.IsNotNull(result); Assert.IsTrue(result.Total >= 800); @@ -545,7 +545,7 @@ public async Task GetPlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Result var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, expression); - // Act + // Assert Assert.IsNotNull(expression); Assert.IsNotNull(result); Assert.IsTrue(result.Total >= 2); @@ -599,7 +599,7 @@ public async Task GetPlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Result var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, expression); - // Act + // Assert Assert.IsNotNull(expression); Assert.IsNotNull(result); Assert.IsTrue(result.Total >= 2); @@ -616,6 +616,197 @@ public async Task GetPlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Result } } + [TestMethodWithRetry(RetryCount = 5)] + public async Task GetRealtimePlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_Based_On_Filter_Query() + { + // Arrange + var expressionFilter = new PlayerFilterExpressionBuilder(); + + // Act + var expression = expressionFilter + .AddFilter(PlayerRealtimeStatisticsFilter.EmptyNetAssists) + .GreaterThan(0) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.ShootsCatches) + .EqualTo(ShootsCatches.Left) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.TeamAbbreviation) + .EqualTo(TeamCodes.TorontoMapleLeafs) + .Build(); + + await using var nhlApi = new NhlApi(); + + var result = await nhlApi.GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, expression); + + // Assert + Assert.IsNotNull(expression); + Assert.IsNotNull(result); + Assert.IsTrue(result.Total >= 1); + + foreach (var player in result.PlayerRealtimeStatisticsResults) + { + Assert.IsNotNull(player); + Assert.IsTrue(player.EmptyNetAssists > 0); + Assert.IsTrue(player.ShootsCatches == ShootsCatches.Left); + Assert.IsTrue(player.TeamAbbrevs == TeamCodes.TorontoMapleLeafs); + } + } + + [TestMethodWithRetry(RetryCount = 5)] + public async Task GetRealtimePlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_Based_On_Filter_Query_For_2020_Season() + { + // Arrange + await using var nhlApi = new NhlApi(); + var expressionFilter = new PlayerFilterExpressionBuilder(); + + // Act + var expression = expressionFilter + .AddFilter(PlayerRealtimeStatisticsFilter.BlockedShots) + .GreaterThan(1) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.ShootsCatches) + .EqualTo(ShootsCatches.Right) + .Build(); + + + var result = await nhlApi.GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20202021, expression); + + // Assert + Assert.IsNotNull(expression); + Assert.IsNotNull(result); + Assert.IsTrue(result.Total >= 300); + + foreach (var player in result.PlayerRealtimeStatisticsResults) + { + Assert.IsTrue(player.BlockedShots > 1); + Assert.IsTrue(player.ShootsCatches == ShootsCatches.Right); + } + } + + [TestMethodWithRetry(RetryCount = 5)] + public async Task GetRealtimePlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_Based_On_Empty_Expression() + { + // Arrange + await using var nhlApi = new NhlApi(); + var expressionFilter = new PlayerFilterExpressionBuilder(); + + // Act + var expression = expressionFilter.Build(); + + var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20102011, expression); + + // Assert + Assert.IsNotNull(expression); + Assert.IsNotNull(result); + Assert.IsTrue(result.Total >= 800); + } + + [TestMethodWithRetry(RetryCount = 5)] + public async Task GetRealtimePlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_Based_On_Filter_Query_For_Complex_Query_1() + { + // Arrange + await using var nhlApi = new NhlApi(); + var expressionFilter = new PlayerFilterExpressionBuilder(); + + // Act + var expression = expressionFilter + .AddFilter(PlayerRealtimeStatisticsFilter.OvertimeGoals) + .GreaterThan(1) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.ShootsCatches) + .EqualTo(ShootsCatches.Right) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.EmptyNetPoints) + .GreaterThan(1) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.EmptyNetGoals) + .GreaterThanOrEqualTo(1) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.GamesPlayed) + .GreaterThanOrEqualTo(20) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.MissedShotCrossbar) + .GreaterThanOrEqualTo(3) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.SkaterFullName) + .Contains("William") + .Build(); + + + var result = await nhlApi.GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, expression); + + // Assert + Assert.IsNotNull(expression); + Assert.IsNotNull(result); + Assert.IsTrue(result.Total == 1); + + foreach (var player in result.PlayerRealtimeStatisticsResults) + { + Assert.IsTrue(player.OvertimeGoals > 1); + Assert.IsTrue(player.ShootsCatches == ShootsCatches.Right); + Assert.IsTrue(player.EmptyNetPoints > 1); + Assert.IsTrue(player.EmptyNetGoals >= 1); + Assert.IsTrue(player.GamesPlayed >= 20); + Assert.IsTrue(player.MissedShotCrossbar >= 3); + Assert.IsTrue(player.SkaterFullName.Contains("William")); + } + } + + [TestMethodWithRetry(RetryCount = 5)] + public async Task GetRealtimePlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_Based_On_Filter_Query_For_Complex_Query_2() + { + // Arrange + await using var nhlApi = new NhlApi(); + var expressionFilter = new PlayerFilterExpressionBuilder(); + + // Act + var expression = expressionFilter + .AddFilter(PlayerRealtimeStatisticsFilter.OvertimeGoals) + .GreaterThan(0) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.ShootsCatches) + .EqualTo(ShootsCatches.Right) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.EmptyNetPoints) + .GreaterThan(0) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.Takeaways) + .GreaterThanOrEqualTo(10) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.TimeOnIcePerGame) + .GreaterThanOrEqualTo(10) + .And() + .AddFilter(PlayerRealtimeStatisticsFilter.HitsPer60) + .GreaterThanOrEqualTo(0.5) + .And() + .StartGroup() + .AddFilter(PlayerRealtimeStatisticsFilter.GamesPlayed) + .LessThanOrEqualTo(20) + .Or() + .AddFilter(PlayerRealtimeStatisticsFilter.FirstGoals) + .GreaterThan(0) + .EndGroup() + .Build(); + + var result = await nhlApi.GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, expression); + + // Assert + Assert.IsNotNull(expression); + Assert.IsNotNull(result); + Assert.IsTrue(result.Total == 47); + + foreach (var player in result.PlayerRealtimeStatisticsResults) + { + Assert.IsTrue(player.OvertimeGoals > 0); + Assert.IsTrue(player.ShootsCatches == ShootsCatches.Right); + Assert.IsTrue(player.EmptyNetPoints > 0); + Assert.IsTrue(player.Takeaways >= 10); + Assert.IsTrue(player.TimeOnIcePerGame >= 10); + Assert.IsTrue(player.HitsPer60 >= 0.5); + Assert.IsTrue(player.GamesPlayed <= 20 || player.FirstGoals > 0); + } + } + [TestMethodWithRetry(RetryCount = 5)] public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_Based_On_Filter_With_No_Query() { @@ -625,7 +816,7 @@ public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Result // Act var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, ExpressionPlayerFilter.Empty); - // Act + // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Total > 800); @@ -648,7 +839,7 @@ public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Result var result = await nhlApi.GetGoalieStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, expression); - // Act + // Assert Assert.IsNotNull(expression); Assert.IsNotNull(result); Assert.IsTrue(result.Total >= 1); @@ -660,6 +851,282 @@ public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Result } } + [TestMethodWithRetry(RetryCount = 5)] + [DataRow("20232024")] + [DataRow("20222023")] + [DataRow("20212022")] + [DataRow("20202021")] + [DataRow("20192020")] + [DataRow("20182019")] + [DataRow("20172018")] + [DataRow("20162017")] + [DataRow("20152016")] + [DataRow("20142015")] + [DataRow("20132014")] + [DataRow("20122013")] + [DataRow("20112012")] + [DataRow("20102011")] + [DataRow("20092010")] + [DataRow("20082009")] + [DataRow("20072008")] + [DataRow("20062007")] + [DataRow("20052006")] + [DataRow("20032004")] + [DataRow("20022003")] + [DataRow("20012002")] + [DataRow("20002001")] + [DataRow("19992000")] + [DataRow("19981999")] + [DataRow("19971998")] + [DataRow("19961997")] + [DataRow("19951996")] + [DataRow("19941995")] + [DataRow("19931994")] + [DataRow("19921993")] + [DataRow("19911992")] + [DataRow("19901991")] + [DataRow("19891990")] + [DataRow("19881989")] + [DataRow("19871988")] + [DataRow("19861987")] + [DataRow("19851986")] + [DataRow("19841985")] + [DataRow("19831984")] + [DataRow("19821983")] + [DataRow("19811982")] + [DataRow("19801981")] + [DataRow("19791980")] + [DataRow("19781979")] + [DataRow("19771978")] + [DataRow("19761977")] + [DataRow("19751976")] + [DataRow("19741975")] + [DataRow("19731974")] + [DataRow("19721973")] + [DataRow("19711972")] + [DataRow("19701971")] + [DataRow("19691970")] + [DataRow("19681969")] + [DataRow("19671968")] + [DataRow("19661967")] + [DataRow("19651966")] + [DataRow("19641965")] + [DataRow("19631964")] + [DataRow("19621963")] + [DataRow("19611962")] + [DataRow("19601961")] + [DataRow("19591960")] + [DataRow("19581959")] + [DataRow("19571958")] + [DataRow("19561957")] + [DataRow("19551956")] + [DataRow("19541955")] + [DataRow("19531954")] + [DataRow("19521953")] + [DataRow("19511952")] + [DataRow("19501951")] + [DataRow("19491950")] + [DataRow("19481949")] + [DataRow("19471948")] + [DataRow("19461947")] + [DataRow("19451946")] + [DataRow("19441945")] + [DataRow("19431944")] + [DataRow("19421943")] + [DataRow("19411942")] + [DataRow("19401941")] + [DataRow("19391940")] + [DataRow("19381939")] + [DataRow("19371938")] + [DataRow("19361937")] + [DataRow("19351936")] + [DataRow("19341935")] + [DataRow("19331934")] + [DataRow("19321933")] + [DataRow("19311932")] + [DataRow("19301931")] + [DataRow("19291930")] + [DataRow("19281929")] + [DataRow("19271928")] + [DataRow("19261927")] + [DataRow("19251926")] + [DataRow("19241925")] + [DataRow("19231924")] + [DataRow("19221923")] + [DataRow("19211922")] + [DataRow("19201921")] + [DataRow("19191920")] + [DataRow("19181919")] + [DataRow("19171918")] + public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_For_Each_Season(string seasonYear) + { + // Arrange + await using var nhlApi = new NhlApi(); + + // Act + var result = await nhlApi.GetGoalieStatisticsBySeasonAndFilterExpressionAsync(seasonYear, ExpressionGoalieFilter.Empty); + + // Assert + Assert.IsNotNull(result); + Assert.IsTrue(result.Total >= 1); + + } + + [TestMethodWithRetry(RetryCount = 5)] + [DataRow("20232024")] + [DataRow("20222023")] + [DataRow("20212022")] + [DataRow("20202021")] + [DataRow("20192020")] + [DataRow("20182019")] + [DataRow("20172018")] + [DataRow("20162017")] + [DataRow("20152016")] + [DataRow("20142015")] + [DataRow("20132014")] + [DataRow("20122013")] + [DataRow("20112012")] + [DataRow("20102011")] + [DataRow("20092010")] + [DataRow("20082009")] + [DataRow("20072008")] + [DataRow("20062007")] + [DataRow("20052006")] + [DataRow("20032004")] + [DataRow("20022003")] + [DataRow("20012002")] + [DataRow("20002001")] + [DataRow("19992000")] + [DataRow("19981999")] + [DataRow("19971998")] + [DataRow("19961997")] + [DataRow("19951996")] + [DataRow("19941995")] + [DataRow("19931994")] + [DataRow("19921993")] + [DataRow("19911992")] + [DataRow("19901991")] + [DataRow("19891990")] + [DataRow("19881989")] + [DataRow("19871988")] + [DataRow("19861987")] + [DataRow("19851986")] + [DataRow("19841985")] + [DataRow("19831984")] + [DataRow("19821983")] + [DataRow("19811982")] + [DataRow("19801981")] + [DataRow("19791980")] + [DataRow("19781979")] + [DataRow("19771978")] + [DataRow("19761977")] + [DataRow("19751976")] + [DataRow("19741975")] + [DataRow("19731974")] + [DataRow("19721973")] + [DataRow("19711972")] + [DataRow("19701971")] + [DataRow("19691970")] + [DataRow("19681969")] + [DataRow("19671968")] + [DataRow("19661967")] + [DataRow("19651966")] + [DataRow("19641965")] + [DataRow("19631964")] + [DataRow("19621963")] + [DataRow("19611962")] + [DataRow("19601961")] + [DataRow("19591960")] + [DataRow("19581959")] + [DataRow("19571958")] + [DataRow("19561957")] + [DataRow("19551956")] + [DataRow("19541955")] + [DataRow("19531954")] + [DataRow("19521953")] + [DataRow("19511952")] + [DataRow("19501951")] + [DataRow("19491950")] + [DataRow("19481949")] + [DataRow("19471948")] + [DataRow("19461947")] + [DataRow("19451946")] + [DataRow("19441945")] + [DataRow("19431944")] + [DataRow("19421943")] + [DataRow("19411942")] + [DataRow("19401941")] + [DataRow("19391940")] + [DataRow("19381939")] + [DataRow("19371938")] + [DataRow("19361937")] + [DataRow("19351936")] + [DataRow("19341935")] + [DataRow("19331934")] + [DataRow("19321933")] + [DataRow("19311932")] + [DataRow("19301931")] + [DataRow("19291930")] + [DataRow("19281929")] + [DataRow("19271928")] + [DataRow("19261927")] + [DataRow("19251926")] + [DataRow("19241925")] + [DataRow("19231924")] + [DataRow("19221923")] + [DataRow("19211922")] + [DataRow("19201921")] + [DataRow("19191920")] + [DataRow("19181919")] + [DataRow("19171918")] + public async Task GetPlayerStatisticsBySeasonAndFilterExpressionAsync_Returns_Valid_Results_For_Each_Season(string seasonYear) + { + // Arrange + await using var nhlApi = new NhlApi(); + + // Act + var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear, ExpressionPlayerFilter.Empty); + + // Assert + Assert.IsNotNull(result); + Assert.IsTrue(result.Total >= 1); + + } + + + [TestMethod] + [DataRow("20042005")] // The 2004–05 NHL season was canceled due to a labor dispute + public async Task GetPlayerStatisticsBySeasonAndFilterExpressionAsync_Returns_Valid_Results_For_Each_Season_With_04_05_Lockout(string seasonYear) + { + // Arrange + await using var nhlApi = new NhlApi(); + + // Act + var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear, ExpressionPlayerFilter.Empty); + + // Assert + Assert.IsNotNull(result); + Assert.AreEqual(0, result.Total); + + } + + [TestMethod] + [DataRow("20042005")] // The 2004–05 NHL season was canceled due to a labor dispute + public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_For_Each_Season_With_04_05_Lockout(string seasonYear) + { + // Arrange + await using var nhlApi = new NhlApi(); + var expressionFilter = new GoalieFilterExpressionBuilder(); + + // Act + var result = await nhlApi.GetGoalieStatisticsBySeasonAndFilterExpressionAsync(seasonYear, ExpressionGoalieFilter.Empty); + + // Assert + Assert.IsNotNull(result); + Assert.AreEqual(0, result.Total); + + } + [TestMethodWithRetry(RetryCount = 5)] public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_Based_On_Filter_Query_For_Empty_Query() { @@ -670,7 +1137,7 @@ public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Result // Act var result = await nhlApi.GetGoalieStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, ExpressionGoalieFilter.Empty); - // Act + // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Total >= 81); @@ -706,7 +1173,7 @@ public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Result var result = await nhlApi.GetGoalieStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20232024, expression); - // Act + // Assert Assert.IsNotNull(expression); Assert.IsNotNull(result); Assert.IsTrue(result.Total >= 1); @@ -716,7 +1183,7 @@ public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Result Assert.IsTrue(player.Wins > 10); Assert.IsTrue(player.GoalsAgainstAverage <= 3.5); Assert.IsTrue(player.Shutouts > 0); - Assert.IsTrue(player.SavePercentage >= 0.9 || player.PenaltyMinutes > 0); + Assert.IsTrue(player.SavePercentage >= 0.9m || player.PenaltyMinutes > 0); } } @@ -759,7 +1226,7 @@ public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Result var result = await nhlApi.GetGoalieStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20182019, expression); - // Act + // Assert Assert.IsNotNull(expression); Assert.IsNotNull(result); Assert.IsTrue(result.Total >= 6); @@ -769,7 +1236,7 @@ public async Task GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Result Assert.IsTrue(player.Wins < 40); Assert.IsTrue(player.GoalsAgainstAverage <= 3.5); Assert.IsTrue(player.Shutouts > 0); - Assert.IsTrue(player.SavePercentage >= 0.9 || player.Assists > 0); + Assert.IsTrue(player.SavePercentage >= 0.9m || player.PenaltyMinutes > 0); Assert.IsTrue(player.GoalieFullName.Contains("An")); Assert.IsTrue(!player.GoalieFullName.Contains("Ze")); Assert.IsTrue(player.PlayerId != 8471214); diff --git a/Nhl.Api.Tests/TeamTests.cs b/Nhl.Api.Tests/TeamTests.cs index 287327a3..669e253d 100644 --- a/Nhl.Api.Tests/TeamTests.cs +++ b/Nhl.Api.Tests/TeamTests.cs @@ -1,9 +1,9 @@ +using System.Linq; using Nhl.Api.Common.Helpers; using Nhl.Api.Models.Enumerations.Team; using Nhl.Api.Models.Season; using Nhl.Api.Models.Team; using Nhl.Api.Services; -using System.Linq; namespace Nhl.Api.Tests; [TestClass] diff --git a/Nhl.Api/Nhl.Api.csproj b/Nhl.Api/Nhl.Api.csproj index 7a435580..196c7af6 100644 --- a/Nhl.Api/Nhl.Api.csproj +++ b/Nhl.Api/Nhl.Api.csproj @@ -1,7 +1,7 @@ - 3.4.2 + 3.5.0 net8.0 Nhl.Api Nhl.Api @@ -58,4 +58,4 @@ - \ No newline at end of file + diff --git a/Nhl.Api/README.md b/Nhl.Api/README.md index b72bfd67..32186e94 100644 --- a/Nhl.Api/README.md +++ b/Nhl.Api/README.md @@ -158,6 +158,7 @@ Thank you to all the people in the hockey community, especially: - [GetPlayerSeasonGameLogsBySeasonAndGameTypeAsync(playerId,seasonYear,gameType,cancellationToken)](#M-Nhl-Api-NhlApi-GetPlayerSeasonGameLogsBySeasonAndGameTypeAsync-System-Int32,System-String,Nhl-Api-Enumerations-Game-GameType,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetPlayerSeasonGameLogsBySeasonAndGameTypeAsync(System.Int32,System.String,Nhl.Api.Enumerations.Game.GameType,System.Threading.CancellationToken)') - [GetPlayerSpotlightAsync(cancellationToken)](#M-Nhl-Api-NhlApi-GetPlayerSpotlightAsync-System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetPlayerSpotlightAsync(System.Threading.CancellationToken)') - [GetPlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerStatisticsFilterToSortBy,limit,offsetStart,cancellationToken)](#M-Nhl-Api-NhlApi-GetPlayerStatisticsBySeasonAndFilterExpressionAsync-System-String,Nhl-Api-Models-Player-ExpressionPlayerFilter,Nhl-Api-Models-Player-PlayerStatisticsFilter,System-Int32,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(System.String,Nhl.Api.Models.Player.ExpressionPlayerFilter,Nhl.Api.Models.Player.PlayerStatisticsFilter,System.Int32,System.Int32,System.Threading.CancellationToken)') + - [GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerRealtimeStatisticsFilterToSortBy,limit,offsetStart,cancellationToken)](#M-Nhl-Api-NhlApi-GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync-System-String,Nhl-Api-Models-Player-ExpressionPlayerFilter,Nhl-Api-Models-Player-PlayerRealtimeStatisticsFilter,System-Int32,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(System.String,Nhl.Api.Models.Player.ExpressionPlayerFilter,Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter,System.Int32,System.Int32,System.Threading.CancellationToken)') - [GetSkaterStatisticsLeadersAsync(playerStatisticsType,seasonYear,gameType,limit,cancellationToken)](#M-Nhl-Api-NhlApi-GetSkaterStatisticsLeadersAsync-Nhl-Api-Enumerations-Statistic-PlayerStatisticsType,Nhl-Api-Enumerations-Game-GameType,System-String,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetSkaterStatisticsLeadersAsync(Nhl.Api.Enumerations.Statistic.PlayerStatisticsType,Nhl.Api.Enumerations.Game.GameType,System.String,System.Int32,System.Threading.CancellationToken)') - [GetSourcesToWatchGamesAsync(cancellationToken)](#M-Nhl-Api-NhlApi-GetSourcesToWatchGamesAsync-System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetSourcesToWatchGamesAsync(System.Threading.CancellationToken)') - [GetTeamColorsAsync(team,cancellationToken)](#M-Nhl-Api-NhlApi-GetTeamColorsAsync-Nhl-Api-Models-Enumerations-Team-TeamEnum,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetTeamColorsAsync(Nhl.Api.Models.Enumerations.Team.TeamEnum,System.Threading.CancellationToken)') @@ -180,6 +181,7 @@ Thank you to all the people in the hockey community, especially: - [GetTeamWeekScheduleByDateAsync(teamAbbreviation,date,cancellationToken)](#M-Nhl-Api-NhlApi-GetTeamWeekScheduleByDateAsync-System-String,System-DateOnly,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetTeamWeekScheduleByDateAsync(System.String,System.DateOnly,System.Threading.CancellationToken)') - [GetTeamWeekScheduleByDateAsync(teamId,date,cancellationToken)](#M-Nhl-Api-NhlApi-GetTeamWeekScheduleByDateAsync-System-Int32,System-DateOnly,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetTeamWeekScheduleByDateAsync(System.Int32,System.DateOnly,System.Threading.CancellationToken)') - [GetTeamWeekScheduleByDateAsync(team,date,cancellationToken)](#M-Nhl-Api-NhlApi-GetTeamWeekScheduleByDateAsync-Nhl-Api-Models-Enumerations-Team-TeamEnum,System-DateOnly,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetTeamWeekScheduleByDateAsync(Nhl.Api.Models.Enumerations.Team.TeamEnum,System.DateOnly,System.Threading.CancellationToken)') + - [GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerTimeOnIceStatisticsFilterToSortBy,limit,offsetStart,cancellationToken)](#M-Nhl-Api-NhlApi-GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync-System-String,Nhl-Api-Models-Player-ExpressionPlayerFilter,Nhl-Api-Models-Player-PlayerTimeOnIceStatisticsFilter,System-Int32,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(System.String,Nhl.Api.Models.Player.ExpressionPlayerFilter,Nhl.Api.Models.Player.PlayerTimeOnIceStatisticsFilter,System.Int32,System.Int32,System.Threading.CancellationToken)') - [GetTotalPlayerStatisticValueByTypeAndSeasonAsync(playerEnum,playerGameCenterStatistic,seasonYear,gameType,cancellationToken)](#M-Nhl-Api-NhlApi-GetTotalPlayerStatisticValueByTypeAndSeasonAsync-Nhl-Api-Models-Enumerations-Player-PlayerEnum,Nhl-Api-Enumerations-Statistic-PlayerGameCenterStatistic,System-String,System-Nullable{Nhl-Api-Enumerations-Game-GameType},System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetTotalPlayerStatisticValueByTypeAndSeasonAsync(Nhl.Api.Models.Enumerations.Player.PlayerEnum,Nhl.Api.Enumerations.Statistic.PlayerGameCenterStatistic,System.String,System.Nullable{Nhl.Api.Enumerations.Game.GameType},System.Threading.CancellationToken)') - [GetTotalPlayerStatisticValueByTypeAndSeasonAsync(playerId,playerGameCenterStatistic,seasonYear,gameType,cancellationToken)](#M-Nhl-Api-NhlApi-GetTotalPlayerStatisticValueByTypeAndSeasonAsync-System-Int32,Nhl-Api-Enumerations-Statistic-PlayerGameCenterStatistic,System-String,System-Nullable{Nhl-Api-Enumerations-Game-GameType},System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetTotalPlayerStatisticValueByTypeAndSeasonAsync(System.Int32,Nhl.Api.Enumerations.Statistic.PlayerGameCenterStatistic,System.String,System.Nullable{Nhl.Api.Enumerations.Game.GameType},System.Threading.CancellationToken)') - [GetTvScheduleBroadcastByDateAsync(date,cancellationToken)](#M-Nhl-Api-NhlApi-GetTvScheduleBroadcastByDateAsync-System-DateOnly,System-Threading-CancellationToken- 'Nhl.Api.NhlApi.GetTvScheduleBroadcastByDateAsync(System.DateOnly,System.Threading.CancellationToken)') @@ -259,11 +261,13 @@ Thank you to all the people in the hockey community, especially: - [GetGoalieStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionGoalieFilter,goalieStatisticsFilterToSortBy,limit,offsetStart,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetGoalieStatisticsBySeasonAndFilterExpressionAsync-System-String,Nhl-Api-Models-Player-ExpressionGoalieFilter,Nhl-Api-Models-Player-GoalieStatisticsFilter,System-Int32,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetGoalieStatisticsBySeasonAndFilterExpressionAsync(System.String,Nhl.Api.Models.Player.ExpressionGoalieFilter,Nhl.Api.Models.Player.GoalieStatisticsFilter,System.Int32,System.Int32,System.Threading.CancellationToken)') - [GetGoalieStatisticsLeadersAsync(goalieStatisticsType,seasonYear,gameType,limit,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetGoalieStatisticsLeadersAsync-Nhl-Api-Enumerations-Statistic-GoalieStatisticsType,Nhl-Api-Enumerations-Game-GameType,System-String,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetGoalieStatisticsLeadersAsync(Nhl.Api.Enumerations.Statistic.GoalieStatisticsType,Nhl.Api.Enumerations.Game.GameType,System.String,System.Int32,System.Threading.CancellationToken)') - [GetPlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerStatisticsFilterToSortBy,limit,offsetStart,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetPlayerStatisticsBySeasonAndFilterExpressionAsync-System-String,Nhl-Api-Models-Player-ExpressionPlayerFilter,Nhl-Api-Models-Player-PlayerStatisticsFilter,System-Int32,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(System.String,Nhl.Api.Models.Player.ExpressionPlayerFilter,Nhl.Api.Models.Player.PlayerStatisticsFilter,System.Int32,System.Int32,System.Threading.CancellationToken)') + - [GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerRealtimeStatisticsFilterToSortBy,limit,offsetStart,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync-System-String,Nhl-Api-Models-Player-ExpressionPlayerFilter,Nhl-Api-Models-Player-PlayerRealtimeStatisticsFilter,System-Int32,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(System.String,Nhl.Api.Models.Player.ExpressionPlayerFilter,Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter,System.Int32,System.Int32,System.Threading.CancellationToken)') - [GetSkaterStatisticsLeadersAsync(playerStatisticsType,seasonYear,gameType,limit,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetSkaterStatisticsLeadersAsync-Nhl-Api-Enumerations-Statistic-PlayerStatisticsType,Nhl-Api-Enumerations-Game-GameType,System-String,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetSkaterStatisticsLeadersAsync(Nhl.Api.Enumerations.Statistic.PlayerStatisticsType,Nhl.Api.Enumerations.Game.GameType,System.String,System.Int32,System.Threading.CancellationToken)') - [GetTeamStatisticsBySeasonAndGameTypeAsync(team,seasonYear,gameType,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetTeamStatisticsBySeasonAndGameTypeAsync-Nhl-Api-Models-Enumerations-Team-TeamEnum,System-String,Nhl-Api-Enumerations-Game-GameType,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetTeamStatisticsBySeasonAndGameTypeAsync(Nhl.Api.Models.Enumerations.Team.TeamEnum,System.String,Nhl.Api.Enumerations.Game.GameType,System.Threading.CancellationToken)') - [GetTeamStatisticsBySeasonAndGameTypeAsync(teamId,seasonYear,gameType,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetTeamStatisticsBySeasonAndGameTypeAsync-System-Int32,System-String,Nhl-Api-Enumerations-Game-GameType,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetTeamStatisticsBySeasonAndGameTypeAsync(System.Int32,System.String,Nhl.Api.Enumerations.Game.GameType,System.Threading.CancellationToken)') - [GetTeamStatisticsBySeasonAsync(team,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetTeamStatisticsBySeasonAsync-Nhl-Api-Models-Enumerations-Team-TeamEnum,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetTeamStatisticsBySeasonAsync(Nhl.Api.Models.Enumerations.Team.TeamEnum,System.Threading.CancellationToken)') - [GetTeamStatisticsBySeasonAsync(teamId,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetTeamStatisticsBySeasonAsync-System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetTeamStatisticsBySeasonAsync(System.Int32,System.Threading.CancellationToken)') + - [GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerTimeOnIceStatisticsFilterToSortBy,limit,offsetStart,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync-System-String,Nhl-Api-Models-Player-ExpressionPlayerFilter,Nhl-Api-Models-Player-PlayerTimeOnIceStatisticsFilter,System-Int32,System-Int32,System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(System.String,Nhl.Api.Models.Player.ExpressionPlayerFilter,Nhl.Api.Models.Player.PlayerTimeOnIceStatisticsFilter,System.Int32,System.Int32,System.Threading.CancellationToken)') - [GetTotalPlayerStatisticValueByTypeAndSeasonAsync(playerEnum,playerGameCenterStatistic,seasonYear,gameType,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetTotalPlayerStatisticValueByTypeAndSeasonAsync-Nhl-Api-Models-Enumerations-Player-PlayerEnum,Nhl-Api-Enumerations-Statistic-PlayerGameCenterStatistic,System-String,System-Nullable{Nhl-Api-Enumerations-Game-GameType},System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetTotalPlayerStatisticValueByTypeAndSeasonAsync(Nhl.Api.Models.Enumerations.Player.PlayerEnum,Nhl.Api.Enumerations.Statistic.PlayerGameCenterStatistic,System.String,System.Nullable{Nhl.Api.Enumerations.Game.GameType},System.Threading.CancellationToken)') - [GetTotalPlayerStatisticValueByTypeAndSeasonAsync(playerId,playerGameCenterStatistic,seasonYear,gameType,cancellationToken)](#M-Nhl-Api-NhlStatisticsApi-GetTotalPlayerStatisticValueByTypeAndSeasonAsync-System-Int32,Nhl-Api-Enumerations-Statistic-PlayerGameCenterStatistic,System-String,System-Nullable{Nhl-Api-Enumerations-Game-GameType},System-Threading-CancellationToken- 'Nhl.Api.NhlStatisticsApi.GetTotalPlayerStatisticValueByTypeAndSeasonAsync(System.Int32,Nhl.Api.Enumerations.Statistic.PlayerGameCenterStatistic,System.String,System.Nullable{Nhl.Api.Enumerations.Game.GameType},System.Threading.CancellationToken)') @@ -1002,6 +1006,28 @@ Returns all the NHL player game center statistics for a specific player for a sp | offsetStart | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The offset to start the results from when reviewing the NHL player statistics | | cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | A cancellation token to cancel the asynchronous operation | + +### GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerRealtimeStatisticsFilterToSortBy,limit,offsetStart,cancellationToken) `method` + +##### Summary + +Returns all the NHL real-time player game center statistics for players matching the provided filter expression for a specific season, including face-off percentage, points per game, overtime goals, shorthanded points, power-play points, shooting percentage, shots, time on ice per game, and more + +##### Returns + +Returns all the NHL real-time player game center statistics for players matching the filter expression for the specified season. + +##### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| seasonYear | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | The NHL season year to retrieve the team statistics, see [SeasonYear](#T-Nhl-Api-Models-Season-SeasonYear 'Nhl.Api.Models.Season.SeasonYear') for more information on valid season years | +| expressionPlayerFilter | [Nhl.Api.Models.Player.ExpressionPlayerFilter](#T-Nhl-Api-Models-Player-ExpressionPlayerFilter 'Nhl.Api.Models.Player.ExpressionPlayerFilter') | The expression player filter to filter the player statistics by, see [PlayerFilterExpressionBuilder](#T-Nhl-Api-Models-Player-PlayerFilterExpressionBuilder 'Nhl.Api.Models.Player.PlayerFilterExpressionBuilder') for more information on valid player filters | +| playerRealtimeStatisticsFilterToSortBy | [Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerRealtimeStatisticsFilter 'Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter') | The player real-time statistics filter to sort the player statistics by, see [PlayerRealtimeStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerRealtimeStatisticsFilter 'Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter') for more information on valid player statistics filters | +| limit | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results | +| offsetStart | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The offset to start the results from when reviewing the NHL player statistics | +| cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | A cancellation token to cancel the asynchronous operation | + ### GetSkaterStatisticsLeadersAsync(playerStatisticsType,seasonYear,gameType,limit,cancellationToken) `method` @@ -1418,6 +1444,28 @@ Returns the NHL team schedule for the specified team and the specified date and | date | [System.DateOnly](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.DateOnly 'System.DateOnly') | The date and time, Example: 2020-10-02 | | cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | A cancellation token that can be used by other objects or threads to receive notice of cancellation | + +### GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerTimeOnIceStatisticsFilterToSortBy,limit,offsetStart,cancellationToken) `method` + +##### Summary + +Returns all the NHL time-on-ice player game center statistics for players matching the provided filter expression for a specified season, including even-strength time on ice, overtime time on ice, time on ice per game, and more + +##### Returns + +Returns all the NHL time-on-ice player game center statistics for players matching the filter expression for the specified season. + +##### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| seasonYear | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | The NHL season year to retrieve the team statistics, see [SeasonYear](#T-Nhl-Api-Models-Season-SeasonYear 'Nhl.Api.Models.Season.SeasonYear') for more information on valid season years | +| expressionPlayerFilter | [Nhl.Api.Models.Player.ExpressionPlayerFilter](#T-Nhl-Api-Models-Player-ExpressionPlayerFilter 'Nhl.Api.Models.Player.ExpressionPlayerFilter') | The expression player filter to filter the player statistics by, see [PlayerFilterExpressionBuilder](#T-Nhl-Api-Models-Player-PlayerFilterExpressionBuilder 'Nhl.Api.Models.Player.PlayerFilterExpressionBuilder') for more information on valid player filters | +| playerTimeOnIceStatisticsFilterToSortBy | [Nhl.Api.Models.Player.PlayerTimeOnIceStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerTimeOnIceStatisticsFilter 'Nhl.Api.Models.Player.PlayerTimeOnIceStatisticsFilter') | The player time-on-ice statistics filter to sort the player statistics by, see [PlayerTimeOnIceStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerTimeOnIceStatisticsFilter 'Nhl.Api.Models.Player.PlayerTimeOnIceStatisticsFilter') for more information on valid player statistics filters | +| limit | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results | +| offsetStart | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The offset to start the results from when reviewing the NHL player statistics | +| cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | A cancellation token to cancel the asynchronous operation | + ### GetTotalPlayerStatisticValueByTypeAndSeasonAsync(playerEnum,playerGameCenterStatistic,seasonYear,gameType,cancellationToken) `method` @@ -2819,6 +2867,28 @@ Returns all the NHL player game center statistics for a specific player for a sp | offsetStart | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The offset to start the results from when reviewing the NHL player statistics | | cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | A cancellation token to cancel the asynchronous operation | + +### GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerRealtimeStatisticsFilterToSortBy,limit,offsetStart,cancellationToken) `method` + +##### Summary + +Returns all the NHL real time player game center statistics for a specific player for a specific season including face off percentage, points per game, overtime goals, short handed points, power play points, shooting percentage, shots, time on ice per game and more + +##### Returns + +Returns all the NHL player game center statistics for a specific player for a specific season including face off percentage, points per game, overtime goals, short handed points , power play points, shooting percentage, shots, time on ice per game and more + +##### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| seasonYear | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | The NHL season year to retrieve the team statistics, see [SeasonYear](#T-Nhl-Api-Models-Season-SeasonYear 'Nhl.Api.Models.Season.SeasonYear') for more information on valid season years | +| expressionPlayerFilter | [Nhl.Api.Models.Player.ExpressionPlayerFilter](#T-Nhl-Api-Models-Player-ExpressionPlayerFilter 'Nhl.Api.Models.Player.ExpressionPlayerFilter') | The expression player filter to filter the player statistics by, see [PlayerFilterExpressionBuilder](#T-Nhl-Api-Models-Player-PlayerFilterExpressionBuilder 'Nhl.Api.Models.Player.PlayerFilterExpressionBuilder') for more information on valid player filters | +| playerRealtimeStatisticsFilterToSortBy | [Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerRealtimeStatisticsFilter 'Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter') | The player statistics filter to sort the player statistics by, see [PlayerRealtimeStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerRealtimeStatisticsFilter 'Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter') for more information on valid player statistics filters | +| limit | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results | +| offsetStart | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The offset to start the results from when reviewing the NHL player statistics | +| cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | A cancellation token to cancel the asynchronous operation | + ### GetSkaterStatisticsLeadersAsync(playerStatisticsType,seasonYear,gameType,limit,cancellationToken) `method` @@ -2916,6 +2986,28 @@ Returns all the NHL team valid game types for all valid NHL seasons for the sele | teamId | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The NHL team identifier, specifying which the NHL team, Example: 55 - Seattle Kraken | | cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | A cancellation token that can be used by other objects or threads to receive notice of cancellation | + +### GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear,expressionPlayerFilter,playerTimeOnIceStatisticsFilterToSortBy,limit,offsetStart,cancellationToken) `method` + +##### Summary + +Returns all the NHL time on ice player game center statistics for a specific player for a specific season including even time on ice, overtime time on ice, over time on ice per over time game time on ice per game and more + +##### Returns + +Returns all the NHL player game center statistics for a specific player for a specific season including face off percentage, points per game, overtime goals, short handed points , power play points, shooting percentage, shots, time on ice per game and more + +##### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| seasonYear | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | The NHL season year to retrieve the team statistics, see [SeasonYear](#T-Nhl-Api-Models-Season-SeasonYear 'Nhl.Api.Models.Season.SeasonYear') for more information on valid season years | +| expressionPlayerFilter | [Nhl.Api.Models.Player.ExpressionPlayerFilter](#T-Nhl-Api-Models-Player-ExpressionPlayerFilter 'Nhl.Api.Models.Player.ExpressionPlayerFilter') | The expression player filter to filter the player statistics by, see [PlayerFilterExpressionBuilder](#T-Nhl-Api-Models-Player-PlayerFilterExpressionBuilder 'Nhl.Api.Models.Player.PlayerFilterExpressionBuilder') for more information on valid player filters | +| playerTimeOnIceStatisticsFilterToSortBy | [Nhl.Api.Models.Player.PlayerTimeOnIceStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerTimeOnIceStatisticsFilter 'Nhl.Api.Models.Player.PlayerTimeOnIceStatisticsFilter') | The player statistics filter to sort the player statistics by, see [PlayerTimeOnIceStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerTimeOnIceStatisticsFilter 'Nhl.Api.Models.Player.PlayerTimeOnIceStatisticsFilter') for more information on valid player statistics filters | +| limit | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results | +| offsetStart | [System.Int32](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Int32 'System.Int32') | The offset to start the results from when reviewing the NHL player statistics | +| cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | A cancellation token to cancel the asynchronous operation | + ### GetTotalPlayerStatisticValueByTypeAndSeasonAsync(playerEnum,playerGameCenterStatistic,seasonYear,gameType,cancellationToken) `method` diff --git a/Nhl.Api/Src/Api/NhlApi.cs b/Nhl.Api/Src/Api/NhlApi.cs index a75b00d4..d238565e 100644 --- a/Nhl.Api/Src/Api/NhlApi.cs +++ b/Nhl.Api/Src/Api/NhlApi.cs @@ -654,6 +654,32 @@ public async Task> GetAllPlayersAsync(CancellationT public async Task>> GetAllPlayersStatisticValuesBySeasonAsync(string seasonYear, GameType? gameType = null, CancellationToken cancellationToken = default) => await _nhlStatisticsApi.GetAllPlayersStatisticValuesBySeasonAsync(seasonYear, gameType, cancellationToken); + /// + /// Returns all the NHL real-time player game center statistics for players matching the provided filter expression for a specific season, including face-off percentage, points per game, overtime goals, shorthanded points, power-play points, shooting percentage, shots, time on ice per game, and more + /// + /// The NHL season year to retrieve the team statistics, see for more information on valid season years + /// The expression player filter to filter the player statistics by, see for more information on valid player filters + /// The player real-time statistics filter to sort the player statistics by, see for more information on valid player statistics filters + /// The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results + /// The offset to start the results from when reviewing the NHL player statistics + /// A cancellation token to cancel the asynchronous operation + /// Returns all the NHL real-time player game center statistics for players matching the filter expression for the specified season. + public async Task GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(string seasonYear, ExpressionPlayerFilter expressionPlayerFilter, PlayerRealtimeStatisticsFilter playerRealtimeStatisticsFilterToSortBy = PlayerRealtimeStatisticsFilter.OvertimeGoals, int limit = -1, int offsetStart = 0, CancellationToken cancellationToken = default) => + await _nhlStatisticsApi.GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear, expressionPlayerFilter, playerRealtimeStatisticsFilterToSortBy, limit, offsetStart, cancellationToken); + + /// + /// Returns all the NHL time-on-ice player game center statistics for players matching the provided filter expression for a specified season, including even-strength time on ice, overtime time on ice, time on ice per game, and more + /// + /// The NHL season year to retrieve the team statistics, see for more information on valid season years + /// The expression player filter to filter the player statistics by, see for more information on valid player filters + /// The player time-on-ice statistics filter to sort the player statistics by, see for more information on valid player statistics filters + /// The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results + /// The offset to start the results from when reviewing the NHL player statistics + /// A cancellation token to cancel the asynchronous operation + /// Returns all the NHL time-on-ice player game center statistics for players matching the filter expression for the specified season. + public async Task GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(string seasonYear, ExpressionPlayerFilter expressionPlayerFilter, PlayerTimeOnIceStatisticsFilter playerTimeOnIceStatisticsFilterToSortBy = PlayerTimeOnIceStatisticsFilter.TimeOnIce, int limit = -1, int offsetStart = 0, CancellationToken cancellationToken = default) => + await _nhlStatisticsApi.GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(seasonYear, expressionPlayerFilter, playerTimeOnIceStatisticsFilterToSortBy, limit, offsetStart, cancellationToken); + /// /// Returns all the NHL player game center statistics for a specific player for a specific season including face off percentage, points per game, overtime goals, short handed points , power play points, shooting percentage, shots, time on ice per game and more /// @@ -692,5 +718,4 @@ public void Dispose() => /// The await-able result of the asynchronous operation public async ValueTask DisposeAsync() => await Task.Run(() => _nhlPlayerApi?.Dispose()); - } diff --git a/Nhl.Api/Src/GameApi/NhlGameApi.cs b/Nhl.Api/Src/GameApi/NhlGameApi.cs index 19d02b86..c9f63641 100644 --- a/Nhl.Api/Src/GameApi/NhlGameApi.cs +++ b/Nhl.Api/Src/GameApi/NhlGameApi.cs @@ -153,8 +153,18 @@ public async Task GetGameCenterLandingByGameIdAsync(int gameI /// The NHL game identifier, Example: 2023020204 /// A cancellation token that can be used by other objects or threads to receive notice of cancellation /// Returns the NHL game center box score for the specified game id, including the game information, game status, game venue and more - public async Task GetGameCenterBoxScoreByGameIdAsync(int gameId, CancellationToken cancellationToken = default) => - await _nhlApiWebHttpClient.GetAsync($"/gamecenter/{gameId}/boxscore", cancellationToken); + public async Task GetGameCenterBoxScoreByGameIdAsync(int gameId, CancellationToken cancellationToken = default) + { + var boxScoreTask = _nhlApiWebHttpClient.GetAsync($"/gamecenter/{gameId}/right-rail", cancellationToken); + var gameCenterBoxScoreTask = _nhlApiWebHttpClient.GetAsync($"/gamecenter/{gameId}/boxscore", cancellationToken); + + await Task.WhenAll(gameCenterBoxScoreTask, boxScoreTask); + + var gameCenterBoxScore = await gameCenterBoxScoreTask; + gameCenterBoxScore.Boxscore = await boxScoreTask; + + return gameCenterBoxScore; + } /// /// Returns the NHL game meta data for the specified game id, including the teams, season states and more diff --git a/Nhl.Api/Src/GlobalUsings.cs b/Nhl.Api/Src/GlobalUsings.cs index e11421c6..01de83f9 100644 --- a/Nhl.Api/Src/GlobalUsings.cs +++ b/Nhl.Api/Src/GlobalUsings.cs @@ -1,11 +1,17 @@ // System // Nhl.Api.Common +global using System; +global using System.Collections.Generic; +global using System.Linq; +global using System.Text; +global using System.Threading; +global using System.Threading.Tasks; global using Nhl.Api.Common.Extensions; global using Nhl.Api.Common.Helpers; global using Nhl.Api.Common.Http; -global using Nhl.Api.Models.Enumerations.Player; global using Nhl.Api.Enumerations.Game; global using Nhl.Api.Enumerations.Statistic; +global using Nhl.Api.Models.Enumerations.Player; global using Nhl.Api.Models.Enumerations.Team; global using Nhl.Api.Models.Game; global using Nhl.Api.Models.League; @@ -15,10 +21,3 @@ global using Nhl.Api.Models.Standing; global using Nhl.Api.Models.Statistics; global using Nhl.Api.Models.Team; - -global using System; -global using System.Collections.Generic; -global using System.Linq; -global using System.Text; -global using System.Threading; -global using System.Threading.Tasks; diff --git a/Nhl.Api/Src/LeagueApi/NhlLeagueApi.cs b/Nhl.Api/Src/LeagueApi/NhlLeagueApi.cs index b17cec28..ae1e8120 100644 --- a/Nhl.Api/Src/LeagueApi/NhlLeagueApi.cs +++ b/Nhl.Api/Src/LeagueApi/NhlLeagueApi.cs @@ -410,6 +410,12 @@ public async Task GetTeamColorsAsync(TeamEnum team, CancellationToke QuaternaryColor = "#68A2B9", QuinaryColor = "#E9072B" }, + TeamEnum.UtahHockeyClub => new TeamColors + { + PrimaryColor = "#69B3E7", + SecondaryColor = "#010101", + TertiaryColor = "#FFFFFF" + }, _ => null, }; diff --git a/Nhl.Api/Src/StatisticsApi/INhlStatisticsApi.cs b/Nhl.Api/Src/StatisticsApi/INhlStatisticsApi.cs index 53af429a..2b182d18 100644 --- a/Nhl.Api/Src/StatisticsApi/INhlStatisticsApi.cs +++ b/Nhl.Api/Src/StatisticsApi/INhlStatisticsApi.cs @@ -1,4 +1,4 @@ -namespace Nhl.Api; +namespace Nhl.Api; /// /// The official unofficial NHL Statistics API providing various NHL information about in-depth player statistics, team statistics and more @@ -138,4 +138,28 @@ public interface INhlStatisticsApi /// Returns all the NHL goalie statistics for a specific goalie for a specific season including face off percentage, points per game, overtime goals, short handed points , power play points, shooting percentage, shots, time on ice per game and more public Task GetGoalieStatisticsBySeasonAndFilterExpressionAsync(string seasonYear, ExpressionGoalieFilter expressionGoalieFilter, GoalieStatisticsFilter goalieStatisticsFilterToSortBy = GoalieStatisticsFilter.Wins, int limit = -1, int offsetStart = 0, CancellationToken cancellationToken = default); + /// + /// Returns all the NHL real time player game center statistics for a specific player for a specific season including face off percentage, points per game, overtime goals, short handed points, power play points, shooting percentage, shots, time on ice per game and more + /// + /// The NHL season year to retrieve the team statistics, see for more information on valid season years + /// The expression player filter to filter the player statistics by, see for more information on valid player filters + /// The player statistics filter to sort the player statistics by, see for more information on valid player statistics filters + /// The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results + /// The offset to start the results from when reviewing the NHL player statistics + /// A cancellation token to cancel the asynchronous operation + /// Returns all the NHL player game center statistics for a specific player for a specific season including face off percentage, points per game, overtime goals, short handed points , power play points, shooting percentage, shots, time on ice per game and more + public Task GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(string seasonYear, ExpressionPlayerFilter expressionPlayerFilter, PlayerRealtimeStatisticsFilter playerRealtimeStatisticsFilterToSortBy = PlayerRealtimeStatisticsFilter.OvertimeGoals, int limit = -1, int offsetStart = 0, CancellationToken cancellationToken = default); + + /// + /// Returns all the NHL time on ice player game center statistics for a specific player for a specific season including even time on ice, overtime time on ice, over time on ice per over time game time on ice per game and more + /// + /// The NHL season year to retrieve the team statistics, see for more information on valid season years + /// The expression player filter to filter the player statistics by, see for more information on valid player filters + /// The player statistics filter to sort the player statistics by, see for more information on valid player statistics filters + /// The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results + /// The offset to start the results from when reviewing the NHL player statistics + /// A cancellation token to cancel the asynchronous operation + /// Returns all the NHL player time on ice statistics for a specific season including even time on ice, overtime time on ice, time on ice per game, and more + public Task GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(string seasonYear, ExpressionPlayerFilter expressionPlayerFilter, PlayerTimeOnIceStatisticsFilter playerTimeOnIceStatisticsFilterToSortBy = PlayerTimeOnIceStatisticsFilter.EvenTimeOnIce, int limit = -1, int offsetStart = 0, CancellationToken cancellationToken = default); + } diff --git a/Nhl.Api/Src/StatisticsApi/NhlStatisticsApi.cs b/Nhl.Api/Src/StatisticsApi/NhlStatisticsApi.cs index fe47c894..d7bda13e 100644 --- a/Nhl.Api/Src/StatisticsApi/NhlStatisticsApi.cs +++ b/Nhl.Api/Src/StatisticsApi/NhlStatisticsApi.cs @@ -618,6 +618,94 @@ public async Task GetGoalieStatisticsBySeasonAndFi return await _nhlEApiWebHttpClient.GetAsync(endpoint.ToString(), cancellationToken); } + /// + /// Returns all the NHL real time player game center statistics for a specific player for a specific season including face off percentage, points per game, overtime goals, short handed points, power play points, shooting percentage, shots, time on ice per game and more + /// + /// The NHL season year to retrieve the team statistics, see for more information on valid season years + /// The expression player filter to filter the player statistics by, see for more information on valid player filters + /// The player statistics filter to sort the player statistics by, see for more information on valid player statistics filters + /// The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results + /// The offset to start the results from when reviewing the NHL player statistics + /// A cancellation token to cancel the asynchronous operation + /// Returns all the NHL player game center statistics for a specific player for a specific season including face off percentage, points per game, overtime goals, short handed points , power play points, shooting percentage, shots, time on ice per game and more + public async Task GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(string seasonYear, ExpressionPlayerFilter expressionPlayerFilter, PlayerRealtimeStatisticsFilter playerRealtimeStatisticsFilterToSortBy = PlayerRealtimeStatisticsFilter.OvertimeGoals, int limit = -1, int offsetStart = 0, CancellationToken cancellationToken = default) + { + if (string.IsNullOrWhiteSpace(seasonYear)) + { + throw new ArgumentException("A season year must be provided to retrieve the NHL player statistics"); + } + + if (expressionPlayerFilter == null) + { + throw new ArgumentException("A player filter expression must be provided to retrieve the NHL player statistics"); + } + + // Validate limit and offsetStart values + if (limit < -1) + { + throw new ArgumentException("Limit must be greater than or equal to -1"); + } + + if (offsetStart < 0) + { + throw new ArgumentException("Offset start must be greater than or equal to 0"); + } + + var endpoint = new StringBuilder($"/skater/realtime?cayenneExp=seasonId={seasonYear}&limit={limit}&start={offsetStart}&sort={playerRealtimeStatisticsFilterToSortBy.GetEnumMemberValue()}"); + if (expressionPlayerFilter.IsValidExpression) + { + endpoint.Append($"&{expressionPlayerFilter}"); + } + + return await _nhlEApiWebHttpClient.GetAsync(endpoint.ToString(), cancellationToken); + } + + /// + /// Returns all the NHL time on ice player game center statistics for a specific player for a specific season including even time on ice, overtime time on ice, over time on ice per over time game time on ice per game and more + /// + /// The NHL season year to retrieve the team statistics, see for more information on valid season years + /// The expression player filter to filter the player statistics by, see for more information on valid player filters + /// The player statistics filter to sort the player statistics by, see for more information on valid player statistics filters + /// The limit to the number of results returned when reviewing the NHL player statistics, by default -1 represents no limit applied to results + /// The offset to start the results from when reviewing the NHL player statistics + /// A cancellation token to cancel the asynchronous operation + /// Returns all the NHL player game center statistics for a specific player for a specific season including face off percentage, points per game, overtime goals, short handed points , power play points, shooting percentage, shots, time on ice per game and more + public async Task GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync(string seasonYear, ExpressionPlayerFilter expressionPlayerFilter, PlayerTimeOnIceStatisticsFilter playerTimeOnIceStatisticsFilterToSortBy = PlayerTimeOnIceStatisticsFilter.TimeOnIce, int limit = -1, int offsetStart = 0, CancellationToken cancellationToken = default) + { + if (string.IsNullOrWhiteSpace(seasonYear)) + { + throw new ArgumentException("A season year must be provided to retrieve the NHL player statistics"); + } + + if (expressionPlayerFilter == null) + { + throw new ArgumentException("A player filter expression must be provided to retrieve the NHL player statistics"); + } + + // Validate limit and offsetStart values + if (limit < -1) + { + throw new ArgumentException("Limit must be greater than or equal to -1"); + } + + if (offsetStart < 0) + { + throw new ArgumentException("Offset start must be greater than or equal to 0"); + } + + var endpoint = new StringBuilder($"/skater/timeonice?cayenneExp=seasonId={seasonYear}&limit={limit}&start={offsetStart}&sort={playerTimeOnIceStatisticsFilterToSortBy.GetEnumMemberValue()}"); + if (expressionPlayerFilter.IsValidExpression) + { + endpoint.Append($"&{expressionPlayerFilter}"); + } + + return await _nhlEApiWebHttpClient.GetAsync(endpoint.ToString(), cancellationToken); + } + + + + #region Private Helper Methods + private static void ValidateSeasonYear(string seasonYear) { if (string.IsNullOrEmpty(seasonYear)) @@ -811,4 +899,6 @@ private static void GetPlayerStatisticTotal(int playerId, GameCenterPlay play, r break; } } + + #endregion }