2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-11-19 21:18:14 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets;
|
2017-11-27 05:06:03 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-11-19 21:18:14 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
|
|
|
{
|
2017-12-11 11:25:29 +08:00
|
|
|
|
public class GetUserMostPlayedBeatmapsRequest : APIRequest<List<MostPlayedBeatmap>>
|
2017-11-19 21:18:14 +08:00
|
|
|
|
{
|
2017-11-27 05:06:03 +08:00
|
|
|
|
private readonly long userId;
|
|
|
|
|
private readonly int offset;
|
|
|
|
|
|
|
|
|
|
public GetUserMostPlayedBeatmapsRequest(long userId, int offset = 0)
|
2017-11-19 21:18:14 +08:00
|
|
|
|
{
|
2017-11-27 05:06:03 +08:00
|
|
|
|
this.userId = userId;
|
|
|
|
|
this.offset = offset;
|
2017-11-19 21:18:14 +08:00
|
|
|
|
}
|
2017-11-27 05:06:03 +08:00
|
|
|
|
|
|
|
|
|
protected override string Target => $@"users/{userId}/beatmapsets/most_played?offset={offset}";
|
2017-11-19 21:18:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-11 11:25:29 +08:00
|
|
|
|
public class MostPlayedBeatmap
|
2017-11-19 21:18:14 +08:00
|
|
|
|
{
|
|
|
|
|
[JsonProperty("beatmap_id")]
|
|
|
|
|
public int BeatmapID;
|
|
|
|
|
|
|
|
|
|
[JsonProperty("count")]
|
|
|
|
|
public int PlayCount;
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
2017-11-25 05:48:56 +08:00
|
|
|
|
private BeatmapInfo beatmap;
|
2017-11-19 21:18:14 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
2017-11-30 06:08:46 +08:00
|
|
|
|
private APIResponseBeatmapSet beatmapSet;
|
2017-11-19 21:18:14 +08:00
|
|
|
|
|
|
|
|
|
public BeatmapInfo GetBeatmapInfo(RulesetStore rulesets)
|
|
|
|
|
{
|
|
|
|
|
BeatmapSetInfo setInfo = beatmapSet.ToBeatmapSet(rulesets);
|
2017-11-25 05:48:56 +08:00
|
|
|
|
beatmap.BeatmapSet = setInfo;
|
|
|
|
|
beatmap.OnlineBeatmapSetID = setInfo.OnlineBeatmapSetID;
|
|
|
|
|
beatmap.Metadata = setInfo.Metadata;
|
|
|
|
|
return beatmap;
|
2017-11-19 21:18:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|