Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
add modern stats xmldoc
Browse files Browse the repository at this point in the history
  • Loading branch information
aspriddell committed Mar 31, 2022
1 parent 1a6ab28 commit e6a8438
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions DragonFruit.Six.Api/Modern/ModernStatsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@
using DragonFruit.Six.Api.Modern.Enums;
using DragonFruit.Six.Api.Modern.Requests;
using DragonFruit.Six.Api.Modern.Utils;
using JetBrains.Annotations;
using Newtonsoft.Json.Linq;

namespace DragonFruit.Six.Api.Modern
{
public static class ModernStatsExtensions
{
/// <summary>
/// Gets the user's recently played maps, with information including K/D, W/L and time alive
/// </summary>
/// <param name="client">The <see cref="Dragon6Client"/> to use</param>
/// <param name="account">The <see cref="UbisoftAccount"/> to get stats for</param>
/// <param name="playlistType">The <see cref="PlaylistType"/> to get stats for</param>
/// <param name="operatorType">The <see cref="OperatorType"/> to filter stats by</param>
/// <param name="startDate">The first day to return stats for. Must be within the last 120 days</param>
/// <param name="endDate">The last day to include stats for. Must be at least 1 day before current UTC time</param>
/// <param name="token">Optional <see cref="CancellationToken"/></param>
/// <returns>A container with the requested map stats. Will return null if no stats found</returns>
[CanBeNull]
public static Task<ModernModeStatsContainer<IEnumerable<ModernMapStats>>> GetModernMapStatsAsync(this Dragon6Client client, UbisoftAccount account, PlaylistType playlistType = PlaylistType.All, OperatorType operatorType = OperatorType.All, DateTimeOffset? startDate = null, DateTimeOffset? endDate = null, CancellationToken token = default)
{
var request = new ModernMapStatsRequest(account)
Expand All @@ -33,6 +46,18 @@ public static Task<ModernModeStatsContainer<IEnumerable<ModernMapStats>>> GetMod
.ContinueWith(t => t.Result.ProcessData<IEnumerable<ModernMapStats>>(request), TaskContinuationOptions.OnlyOnRanToCompletion);
}

/// <summary>
/// Gets the user's recently played operators, with information including K/D, W/L and time alive
/// </summary>
/// <param name="client">The <see cref="Dragon6Client"/> to use</param>
/// <param name="account">The <see cref="UbisoftAccount"/> to get stats for</param>
/// <param name="playlistType">The <see cref="PlaylistType"/> to get stats for</param>
/// <param name="operatorType">The <see cref="OperatorType"/> to filter stats by</param>
/// <param name="startDate">The first day to return stats for. Must be within the last 120 days</param>
/// <param name="endDate">The last day to include stats for. Must be at least 1 day before current UTC time</param>
/// <param name="token">Optional <see cref="CancellationToken"/></param>
/// <returns>A container with the requested operator stats. Will return null if no stats found</returns>
[CanBeNull]
public static Task<ModernModeStatsContainer<IEnumerable<ModernOperatorStats>>> GetModernOperatorStatsAsync(this Dragon6Client client, UbisoftAccount account, PlaylistType playlistType = PlaylistType.All, OperatorType operatorType = OperatorType.All, DateTimeOffset? startDate = null, DateTimeOffset? endDate = null, CancellationToken token = default)
{
var request = new ModernOperatorStatsRequest(account)
Expand All @@ -48,6 +73,15 @@ public static Task<ModernModeStatsContainer<IEnumerable<ModernOperatorStats>>> G
.ContinueWith(t => t.Result.ProcessData<IEnumerable<ModernOperatorStats>>(request), TaskContinuationOptions.OnlyOnRanToCompletion);
}

/// <summary>
/// Gets the user's seasonal history
/// </summary>
/// <param name="client">The <see cref="Dragon6Client"/> to use</param>
/// <param name="account">The <see cref="UbisoftAccount"/> to get stats for</param>
/// <param name="playlistType">The <see cref="PlaylistType"/> to get stats for</param>
/// <param name="token">Optional <see cref="CancellationToken"/></param>
/// <returns>A container with all seasons tracked. Will return null if no stats found</returns>
[CanBeNull]
public static Task<ModernModeStatsContainer<IEnumerable<ModernSeasonStats>>> GetModernSeasonStatsAsync(this Dragon6Client client, UbisoftAccount account, PlaylistType playlistType = PlaylistType.All, CancellationToken token = default)
{
var request = new ModernSeasonalStatsRequest(account)
Expand All @@ -59,6 +93,19 @@ public static Task<ModernModeStatsContainer<IEnumerable<ModernSeasonStats>>> Get
.ContinueWith(t => t.Result.ProcessData<IEnumerable<ModernSeasonStats>>(request), TaskContinuationOptions.OnlyOnRanToCompletion);
}

/// <summary>
/// Gets a summary of the user's current activity, with information including K/D, W/L and time alive
/// </summary>
/// <param name="client">The <see cref="Dragon6Client"/> to use</param>
/// <param name="account">The <see cref="UbisoftAccount"/> to get stats for</param>
/// <param name="playlistType">The <see cref="PlaylistType"/> to get stats for</param>
/// <param name="operatorType">The <see cref="OperatorType"/> to filter stats by</param>
/// <param name="startDate">The first day to return stats for. Must be within the last 120 days</param>
/// <param name="endDate">The last day to include stats for. Must be at least 1 day before current UTC time</param>
/// <param name="token">Optional <see cref="CancellationToken"/></param>
/// <returns>A container with the requested stats. Will return null if no stats found.</returns>
/// <remarks>This returns a collection of <see cref="ModernStatsSummary"/> items, but is recommended to use FirstOrDefault() to get the correct stats object</remarks>
[CanBeNull]
public static Task<ModernModeStatsContainer<IEnumerable<ModernStatsSummary>>> GetModernStatsSummaryAsync(this Dragon6Client client, UbisoftAccount account, PlaylistType playlistType = PlaylistType.All, OperatorType operatorType = OperatorType.All, DateTimeOffset? startDate = null, DateTimeOffset? endDate = null, CancellationToken token = default)
{
var request = new ModernStatsSummaryRequest(account)
Expand All @@ -74,6 +121,18 @@ public static Task<ModernModeStatsContainer<IEnumerable<ModernStatsSummary>>> Ge
.ContinueWith(t => t.Result.ProcessData<IEnumerable<ModernStatsSummary>>(request), TaskContinuationOptions.OnlyOnRanToCompletion);
}

/// <summary>
/// Gets the user's graphs
/// </summary>
/// <param name="client">The <see cref="Dragon6Client"/> to use</param>
/// <param name="account">The <see cref="UbisoftAccount"/> to get stats for</param>
/// <param name="playlistType">The <see cref="PlaylistType"/> to get stats for</param>
/// <param name="operatorType">The <see cref="OperatorType"/> to filter stats by</param>
/// <param name="startDate">The first day to return stats for. Must be within the last 120 days</param>
/// <param name="endDate">The last day to include stats for. Must be at least 1 day before current UTC time</param>
/// <param name="token">Optional <see cref="CancellationToken"/></param>
/// <returns>A container with the data needed to plot the graphs seen on the ubisoft stats site. Will return null if no stats found</returns>
[CanBeNull]
public static Task<ModernModeStatsContainer<IEnumerable<ModernStatsTrend>>> GetModernStatsTrendAsync(this Dragon6Client client, UbisoftAccount account, PlaylistType playlistType = PlaylistType.All, OperatorType operatorType = OperatorType.All, DateTimeOffset? startDate = null, DateTimeOffset? endDate = null, CancellationToken token = default)
{
var request = new ModernStatsTrendRequest(account)
Expand All @@ -90,6 +149,18 @@ public static Task<ModernModeStatsContainer<IEnumerable<ModernStatsTrend>>> GetM
.ContinueWith(t => t.Result.ProcessData<IEnumerable<ModernStatsTrend>>(request), TaskContinuationOptions.OnlyOnRanToCompletion);
}

/// <summary>
/// Gets the user's recently used weapons
/// </summary>
/// <param name="client">The <see cref="Dragon6Client"/> to use</param>
/// <param name="account">The <see cref="UbisoftAccount"/> to get stats for</param>
/// <param name="playlistType">The <see cref="PlaylistType"/> to get stats for</param>
/// <param name="operatorType">The <see cref="OperatorType"/> to filter stats by</param>
/// <param name="startDate">The first day to return stats for. Must be within the last 120 days</param>
/// <param name="endDate">The last day to include stats for. Must be at least 1 day before current UTC time</param>
/// <param name="token">Optional <see cref="CancellationToken"/></param>
/// <returns>A container with the requested weapon stats. Will return null if no stats found</returns>
[CanBeNull]
public static Task<ModernModeStatsContainer<WeaponSlot>> GetModernWeaponStatsAsync(this Dragon6Client client, UbisoftAccount account, PlaylistType playlistType = PlaylistType.All, OperatorType operatorType = OperatorType.All, DateTimeOffset? startDate = null, DateTimeOffset? endDate = null, CancellationToken token = default)
{
var request = new ModernWeaponStatsRequest(account)
Expand Down

0 comments on commit e6a8438

Please sign in to comment.