/// <summary>
        /// Get seasonal stats for the provided <see cref="UbisoftAccount"/>
        /// </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="seasonId">The season id. Defaults to the current season</param>
        /// <param name="board">The leaderboard to get rankings for</param>
        /// <param name="region">The region to get stats for. Seasons after ~17 do not need to set this</param>
        /// <param name="token">Optional cancellation token</param>
        public static Task <SeasonalStats> GetSeasonalStatsAsync(this Dragon6Client client, UbisoftAccount account, int seasonId = -1, BoardType board = BoardType.Ranked, Region region = Region.EMEA, CancellationToken token = default)
        {
            var request = new SeasonalStatsRequest(account.Yield(), board, seasonId, region);

            return(client.PerformAsync <SeasonalStatsResponse>(request, token).ContinueWith(t => t.Result.For(account), TaskContinuationOptions.OnlyOnRanToCompletion));
        }
예제 #2
0
 public static bool TryRetrieveFor <T>(this IReadOnlyDictionary <string, T> lookup, UbisoftAccount account, out T output) where T : class
 {
     output = For(lookup, account);
     return(output != null);
 }
예제 #3
0
 public static bool TryRetrieveFor <T>(this ILookup <string, T> lookup, UbisoftAccount account, out IEnumerable <T> output) where T : class
 {
     output = For(lookup, account);
     return(output != null);
 }
예제 #4
0
 public static T For <T>(this IReadOnlyDictionary <string, T> lookup, UbisoftAccount account) where T : class => For(lookup, account.ProfileId);
예제 #5
0
 public static IEnumerable <T> For <T>(this ILookup <string, T> lookup, UbisoftAccount account) where T : class => For(lookup, account.ProfileId);
예제 #6
0
 public ModernMapStatsRequest(UbisoftAccount account)
     : base(account)
 {
 }
예제 #7
0
 public ModernWeaponStatsRequest(UbisoftAccount account)
     : base(account)
 {
 }
예제 #8
0
        public static Task <ModernModeStatsContainer <WeaponSlot> > GetModernWeaponStatsAsync(this Dragon6Client client, UbisoftAccount account, PlaylistType playlistType = PlaylistType.All, OperatorType operatorType = OperatorType.Independent, DateTimeOffset?startDate = null, DateTimeOffset?endDate = null)
        {
            var request = new ModernWeaponStatsRequest(account)
            {
                Playlist     = playlistType,
                OperatorType = operatorType
            };

            ValueUtils.ApplyValue(startDate, s => request.StartDate = s);
            ValueUtils.ApplyValue(endDate, e => request.EndDate     = e);

            return(client.PerformAsync <JObject>(request)
                   .ContinueWith(t => t.Result.ProcessData <WeaponSlot>(request), TaskContinuationOptions.OnlyOnRanToCompletion));
        }
예제 #9
0
 public ModernStatsTrendRequest(UbisoftAccount account)
     : base(account)
 {
 }
예제 #10
0
 protected ModernStatsRequest(UbisoftAccount account)
 {
     Account = account ?? throw new NullReferenceException();
 }
예제 #11
0
        public static Task <ModernModeStatsContainer <IEnumerable <ModernSeasonStats> > > GetModernSeasonStatsAsync(this Dragon6Client client, UbisoftAccount account, PlaylistType playlistType = PlaylistType.All)
        {
            var request = new ModernSeasonalStatsRequest(account)
            {
                Playlist = playlistType
            };

            return(client.PerformAsync <JObject>(request)
                   .ContinueWith(t => t.Result.ProcessData <IEnumerable <ModernSeasonStats> >(request), TaskContinuationOptions.OnlyOnRanToCompletion));
        }
예제 #12
0
 public SeasonalStats For(UbisoftAccount account) => For(account.ProfileId);
 public ModernOperatorStatsRequest(UbisoftAccount account)
     : base(account)
 {
 }
예제 #14
0
 public ModernStatsSummaryRequest(UbisoftAccount account)
     : base(account)
 {
 }
예제 #15
0
 /// <summary>
 /// Gets the <see cref="LegacyWeaponStats"/> for the <see cref="UbisoftAccount"/> provided
 /// </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="token">Optional cancellation token</param>
 /// <returns><see cref="IEnumerable{T}"/> of <see cref="LegacyWeaponStats"/> for the provided <see cref="UbisoftAccount"/></returns>
 public static Task <IEnumerable <LegacyWeaponStats> > GetLegacyWeaponStatsAsync(this Dragon6Client client, UbisoftAccount account, CancellationToken token = default)
 {
     return(GetLegacyWeaponStatsAsync(client, account.Yield(), token).ContinueWith(t => t.Result.For(account), TaskContinuationOptions.OnlyOnRanToCompletion));
 }
예제 #16
0
 /// <summary>
 /// Creates a <see cref="UbisoftAccountActivityRequest"/> for a single <see cref="UbisoftAccount"/>
 /// </summary>
 public UbisoftAccountActivityRequest(UbisoftAccount profile)
     : this(profile.Yield())
 {
 }
예제 #17
0
 public ModernSeasonalStatsRequest(UbisoftAccount account)
     : base(account)
 {
 }
        /// <summary>
        /// Retrieves the play statistics for a <see cref="UbisoftAccount"/>
        /// </summary>
        /// <param name="client">The <see cref="Dragon6Client"/> to use</param>
        /// <param name="account">The <see cref="UbisoftAccount"/> to get play stats for</param>
        /// <returns>The <see cref="UbisoftAccountActivity"/> for the account, or <c>null</c> if the user does not own the game</returns>
        public static Task <UbisoftAccountActivity> GetAccountActivityAsync(this Dragon6Client client, UbisoftAccount account)
        {
            var request = new UbisoftAccountActivityRequest(account);

            return(client.PerformAsync <JObject>(request).ContinueWith(t => t.Result.DeserializeUbisoftAccountActivity().For(account), TaskContinuationOptions.OnlyOnRanToCompletion));
        }