2017-11-19 21:18:14 +08: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.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-11-27 05:06:03 +08:00
|
|
|
|
public class GetUserMostPlayedBeatmapsRequest : APIRequest<List<UserMostPlayedBeatmapsResponse>>
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class UserMostPlayedBeatmapsResponse
|
|
|
|
|
{
|
|
|
|
|
[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]
|
|
|
|
|
private GetBeatmapSetsResponse beatmapSet;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|