Skip to content

Commit

Permalink
Add a parameter to filter out new Records
Browse files Browse the repository at this point in the history
This allows you to filter out new records from a leaderboard. If you are
interested in how the leaderboard used to look like, you can use this
parameter.
  • Loading branch information
CryZe committed Aug 6, 2015
1 parent 25b3e1e commit 32cdcbc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SpeedrunComSharp

[![API Version](https://img.shields.io/badge/API-d21a84...-blue.svg)](https://github.com/speedruncom/api/tree/d21a84b4061d6e743c0bd58ddcde3a5f484232a4)
[![API Version](https://img.shields.io/badge/API-34c8b9...-blue.svg)](https://github.com/speedruncom/api/tree/34c8b9f2ac3d1b7817d24c9c51ed8f1f4b84c1c0)
[![Build Status](https://travis-ci.org/LiveSplit/SpeedrunComSharp.svg?branch=master)](https://travis-ci.org/LiveSplit/SpeedrunComSharp)
[![Build status](https://ci.appveyor.com/api/projects/status/w383t09ffk5ovo7y/branch/master?svg=true)](https://ci.appveyor.com/project/CryZe/speedruncomsharp/branch/master)
[![Coverity Scan Build Status](https://img.shields.io/coverity/scan/5662.svg)](https://scan.coverity.com/projects/5662)
Expand Down
19 changes: 14 additions & 5 deletions SpeedrunComSharp/Leaderboards/LeaderboardsClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;

namespace SpeedrunComSharp
{
Expand All @@ -23,7 +24,7 @@ private Leaderboard getLeaderboard(
string uri, int? top = null,
string platformId = null, string regionId = null,
EmulatorsFilter emulatorsFilter = EmulatorsFilter.NotSet, bool filterOutRunsWithoutVideo = false,
TimingMethod? orderBy = null,
TimingMethod? orderBy = null, DateTime? filterOutRunsAfter = null,
IEnumerable<VariableValue> variableFilters = null,
LeaderboardEmbeds embeds = default(LeaderboardEmbeds))
{
Expand All @@ -45,6 +46,12 @@ private Leaderboard getLeaderboard(
var timing = orderBy.Value.ToAPIString();
parameters.Add(string.Format("timing={0}", timing));
}
if (filterOutRunsAfter.HasValue)
{
var date = filterOutRunsAfter.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
parameters.Add(string.Format("date={0}",
Uri.EscapeDataString(date)));
}
if (variableFilters != null)
{
foreach (var variableValue in variableFilters)
Expand All @@ -68,7 +75,7 @@ public Leaderboard GetLeaderboardForFullGameCategory(
int? top = null,
string platformId = null, string regionId = null,
EmulatorsFilter emulatorsFilter = EmulatorsFilter.NotSet, bool filterOutRunsWithoutVideo = false,
TimingMethod? orderBy = null,
TimingMethod? orderBy = null, DateTime? filterOutRunsAfter = null,
IEnumerable<VariableValue> variableFilters = null,
LeaderboardEmbeds embeds = default(LeaderboardEmbeds))
{
Expand All @@ -80,7 +87,8 @@ public Leaderboard GetLeaderboardForFullGameCategory(
top,
platformId, regionId,
emulatorsFilter, filterOutRunsWithoutVideo,
orderBy, variableFilters,
orderBy, filterOutRunsAfter,
variableFilters,
embeds);
}

Expand All @@ -89,7 +97,7 @@ public Leaderboard GetLeaderboardForLevel(
int? top = null,
string platformId = null, string regionId = null,
EmulatorsFilter emulatorsFilter = EmulatorsFilter.NotSet, bool filterOutRunsWithoutVideo = false,
TimingMethod? orderBy = null,
TimingMethod? orderBy = null, DateTime? filterOutRunsAfter = null,
IEnumerable<VariableValue> variableFilters = null,
LeaderboardEmbeds embeds = default(LeaderboardEmbeds))
{
Expand All @@ -102,7 +110,8 @@ public Leaderboard GetLeaderboardForLevel(
top,
platformId, regionId,
emulatorsFilter, filterOutRunsWithoutVideo,
orderBy, variableFilters,
orderBy, filterOutRunsAfter,
variableFilters,
embeds);
}
}
Expand Down

0 comments on commit 32cdcbc

Please sign in to comment.