< Summary

Information
Class: KicktippIntegration.BetPrediction
Assembly: KicktippIntegration
File(s): /home/runner/work/KicktippAi/KicktippAi/src/KicktippIntegration/IKicktippClient.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 153
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_HomeGoals()100%11100%
set_HomeGoals(...)100%210%
get_AwayGoals()100%11100%
set_AwayGoals(...)100%210%
.ctor(...)100%210%
ToString()100%11100%

File(s)

/home/runner/work/KicktippAi/KicktippAi/src/KicktippIntegration/IKicktippClient.cs

#LineLine coverage
 1using EHonda.KicktippAi.Core;
 2
 3namespace KicktippIntegration;
 4
 5/// <summary>
 6/// Interface for the Kicktipp client responsible for interacting with kicktipp.de
 7/// Authentication is handled automatically via dependency injection
 8/// </summary>
 9public interface IKicktippClient
 10{
 11    /// <summary>
 12    /// Get open predictions for a specific community
 13    /// </summary>
 14    /// <param name="community">The community name</param>
 15    /// <returns>List of matches with open predictions</returns>
 16    Task<List<Match>> GetOpenPredictionsAsync(string community);
 17
 18    /// <summary>
 19    /// Place a bet for a specific match in a community
 20    /// </summary>
 21    /// <param name="community">The community name</param>
 22    /// <param name="match">The match to bet on</param>
 23    /// <param name="prediction">The bet prediction</param>
 24    /// <param name="overrideBet">If true, overrides an existing bet for this match</param>
 25    /// <returns>True if the bet was placed successfully</returns>
 26    Task<bool> PlaceBetAsync(string community, Match match, BetPrediction prediction, bool overrideBet = false);
 27
 28    /// <summary>
 29    /// Place multiple bets for matches in a community
 30    /// </summary>
 31    /// <param name="community">The community name</param>
 32    /// <param name="bets">Dictionary of matches and their corresponding predictions</param>
 33    /// <param name="overrideBets">If true, overrides existing bets for the matches</param>
 34    /// <returns>True if all bets were placed successfully</returns>
 35    Task<bool> PlaceBetsAsync(string community, Dictionary<Match, BetPrediction> bets, bool overrideBets = false);
 36
 37    /// <summary>
 38    /// Get the current standings (league table) for a specific community
 39    /// </summary>
 40    /// <param name="community">The community name</param>
 41    /// <returns>List of team standings ordered by position</returns>
 42    Task<List<TeamStanding>> GetStandingsAsync(string community);
 43
 44    /// <summary>
 45    /// Get matches with detailed information including recent history for both teams
 46    /// </summary>
 47    /// <param name="community">The community name</param>
 48    /// <returns>List of matches with their recent history context</returns>
 49    Task<List<MatchWithHistory>> GetMatchesWithHistoryAsync(string community);
 50
 51    /// <summary>
 52    /// Gets the currently displayed matchday index from the community's tippuebersicht page.
 53    /// </summary>
 54    /// <param name="community">The community name.</param>
 55    /// <returns>The currently displayed matchday index.</returns>
 56    Task<int> GetCurrentTippuebersichtMatchdayAsync(string community);
 57
 58    /// <summary>
 59    /// Gets all match outcomes shown on the tippuebersicht page for a specific matchday.
 60    /// </summary>
 61    /// <param name="community">The community name.</param>
 62    /// <param name="matchday">The matchday index to load.</param>
 63    /// <returns>All matches listed on the requested matchday page, including incomplete ones.</returns>
 64    Task<IReadOnlyList<CollectedMatchOutcome>> GetMatchdayOutcomesAsync(string community, int matchday);
 65
 66    /// <summary>
 67    /// Get home/away specific match history for both teams from a match
 68    /// </summary>
 69    /// <param name="community">The community name</param>
 70    /// <param name="homeTeam">The home team name</param>
 71    /// <param name="awayTeam">The away team name</param>
 72    /// <returns>Tuple containing home team's home history and away team's away history</returns>
 73    Task<(List<MatchResult> homeTeamHomeHistory, List<MatchResult> awayTeamAwayHistory)> GetHomeAwayHistoryAsync(string 
 74
 75    /// <summary>
 76    /// Get head-to-head match history between two teams
 77    /// </summary>
 78    /// <param name="community">The community name</param>
 79    /// <param name="homeTeam">The home team name</param>
 80    /// <param name="awayTeam">The away team name</param>
 81    /// <returns>List of head-to-head match results</returns>
 82    Task<List<MatchResult>> GetHeadToHeadHistoryAsync(string community, string homeTeam, string awayTeam);
 83
 84    /// <summary>
 85    /// Get head-to-head match history between two teams with detailed column breakdown for CSV export
 86    /// </summary>
 87    /// <param name="community">The community name</param>
 88    /// <param name="homeTeam">The home team name</param>
 89    /// <param name="awayTeam">The away team name</param>
 90    /// <returns>List of head-to-head results with separate League, Matchday, PlayedAt columns</returns>
 91    Task<List<HeadToHeadResult>> GetHeadToHeadDetailedHistoryAsync(string community, string homeTeam, string awayTeam);
 92
 93    /// <summary>
 94    /// Get placed predictions for the current matchday
 95    /// </summary>
 96    /// <param name="community">The community name</param>
 97    /// <returns>Dictionary of matches and their placed predictions</returns>
 98    Task<Dictionary<Match, BetPrediction?>> GetPlacedPredictionsAsync(string community);
 99
 100    /// <summary>
 101    /// Get open bonus questions for a specific community
 102    /// </summary>
 103    /// <param name="community">The community name</param>
 104    /// <returns>List of bonus questions with open predictions</returns>
 105    Task<List<BonusQuestion>> GetOpenBonusQuestionsAsync(string community);
 106
 107    /// <summary>
 108    /// Place bonus predictions for a community
 109    /// </summary>
 110    /// <param name="community">The community name</param>
 111    /// <param name="predictions">Dictionary of bonus question IDs and their corresponding predictions</param>
 112    /// <param name="overridePredictions">If true, overrides existing predictions for the questions</param>
 113    /// <returns>True if all predictions were placed successfully</returns>
 114    Task<bool> PlaceBonusPredictionsAsync(string community, Dictionary<string, BonusPrediction> predictions, bool overri
 115
 116    /// <summary>
 117    /// Get placed bonus predictions for a community
 118    /// </summary>
 119    /// <param name="community">The community name</param>
 120    /// <returns>Dictionary of bonus question IDs and their currently placed predictions, or null if no prediction is pl
 121    Task<Dictionary<string, BonusPrediction?>> GetPlacedBonusPredictionsAsync(string community);
 122}
 123
 124/// <summary>
 125/// Represents login credentials for kicktipp.de
 126/// Used for dependency injection configuration
 127/// </summary>
 128public record KicktippCredentials(string Username, string Password)
 129{
 130    public bool IsValid => !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password);
 131}
 132
 133/// <summary>
 134/// Configuration class for Kicktipp credentials
 135/// Used with IOptions pattern for dependency injection
 136/// </summary>
 137public class KicktippOptions
 138{
 139    public const string ConfigurationSectionName = "Kicktipp";
 140
 141    public string Username { get; set; } = string.Empty;
 142    public string Password { get; set; } = string.Empty;
 143
 144    public KicktippCredentials ToCredentials() => new(Username, Password);
 145}
 146
 147/// <summary>
 148/// Represents a bet prediction with home and away goals
 149/// </summary>
 1150public record BetPrediction(int HomeGoals, int AwayGoals)
 151{
 1152    public override string ToString() => $"{HomeGoals}:{AwayGoals}";
 153}