2017-04-24 10:17:11 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using osu.Game.Database;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
|
|
|
{
|
2017-04-30 12:45:23 +00:00
|
|
|
|
public class GetBeatmapDetailsRequest : APIRequest<GetBeatmapDetailsResponse>
|
2017-04-24 10:17:11 +00:00
|
|
|
|
{
|
|
|
|
|
private readonly BeatmapInfo beatmap;
|
|
|
|
|
|
2017-04-24 11:16:31 +00:00
|
|
|
|
private string lookupString => beatmap.OnlineBeatmapID > 0 ? beatmap.OnlineBeatmapID.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}";
|
2017-04-24 10:17:11 +00:00
|
|
|
|
|
2017-04-24 10:33:48 +00:00
|
|
|
|
public GetBeatmapDetailsRequest(BeatmapInfo beatmap)
|
2017-04-24 10:17:11 +00:00
|
|
|
|
{
|
|
|
|
|
this.beatmap = beatmap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Target => $@"beatmaps/{lookupString}";
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-30 12:45:23 +00:00
|
|
|
|
public class GetBeatmapDetailsResponse : BeatmapMetrics
|
2017-04-24 10:17:11 +00:00
|
|
|
|
{
|
|
|
|
|
//the online API returns some metrics as a nested object.
|
|
|
|
|
[JsonProperty(@"failtimes")]
|
|
|
|
|
private BeatmapMetrics failTimes
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-04-24 11:16:31 +00:00
|
|
|
|
Fails = value.Fails;
|
|
|
|
|
Retries = value.Retries;
|
2017-04-24 10:17:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//and other metrics in the beatmap set.
|
|
|
|
|
[JsonProperty(@"beatmapset")]
|
|
|
|
|
private BeatmapMetrics beatmapSet
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-04-24 11:16:31 +00:00
|
|
|
|
Ratings = value.Ratings;
|
2017-04-24 10:17:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|