2017-11-04 01:25:21 +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
|
|
|
|
|
|
2017-11-19 21:18:14 +08:00
|
|
|
|
using System;
|
2017-11-07 17:38:10 +08:00
|
|
|
|
using Humanizer;
|
2017-11-04 01:25:21 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
|
|
|
{
|
2017-11-19 21:33:50 +08:00
|
|
|
|
public abstract class GetUserBeatmapsRequest<T> : APIRequest<List<T>>
|
2017-11-04 01:25:21 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly long userId;
|
|
|
|
|
private readonly int offset;
|
2017-11-07 17:38:10 +08:00
|
|
|
|
private readonly BeatmapSetType type;
|
2017-11-04 01:25:21 +08:00
|
|
|
|
|
2017-11-19 21:18:14 +08:00
|
|
|
|
protected GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0)
|
2017-11-04 01:25:21 +08:00
|
|
|
|
{
|
|
|
|
|
this.userId = userId;
|
|
|
|
|
this.offset = offset;
|
2017-11-07 17:38:10 +08:00
|
|
|
|
this.type = type;
|
2017-11-04 01:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-07 17:38:10 +08:00
|
|
|
|
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}?offset={offset}";
|
2017-11-04 01:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-19 21:18:14 +08:00
|
|
|
|
public class GetUserBeatmapsRequest : GetUserBeatmapsRequest<GetBeatmapSetsResponse>
|
|
|
|
|
{
|
|
|
|
|
public GetUserBeatmapsRequest(long userID, BeatmapSetType type, int offset = 0)
|
|
|
|
|
: base(userID, type, offset)
|
|
|
|
|
{
|
|
|
|
|
if(type == BeatmapSetType.MostPlayed)
|
|
|
|
|
throw new ArgumentException("Please use " + nameof(GetUserMostPlayedBeatmapsRequest) + " instead");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-04 01:25:21 +08:00
|
|
|
|
public enum BeatmapSetType
|
|
|
|
|
{
|
2017-11-07 02:46:28 +08:00
|
|
|
|
MostPlayed,
|
2017-11-04 01:25:21 +08:00
|
|
|
|
Favourite,
|
2017-11-14 13:26:44 +08:00
|
|
|
|
RankedAndApproved,
|
|
|
|
|
Unranked,
|
|
|
|
|
Graveyard
|
2017-11-04 01:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|