mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
separate GetUserBeatmapsRequest and GetUserMostPlayedBeatmapsRequest
This commit is contained in:
@ -1,19 +1,18 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using Humanizer;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public abstract class GetUserBeatmapsRequest<T> : APIRequest<List<T>>
|
||||
public class GetUserBeatmapsRequest : APIRequest<List<GetBeatmapSetsResponse>>
|
||||
{
|
||||
private readonly long userId;
|
||||
private readonly int offset;
|
||||
private readonly BeatmapSetType type;
|
||||
|
||||
protected GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0)
|
||||
public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.offset = offset;
|
||||
@ -23,19 +22,8 @@ namespace osu.Game.Online.API.Requests
|
||||
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}?offset={offset}";
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
public enum BeatmapSetType
|
||||
{
|
||||
MostPlayed,
|
||||
Favourite,
|
||||
RankedAndApproved,
|
||||
Unranked,
|
||||
|
@ -1,21 +1,25 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUserMostPlayedBeatmapsRequest : GetUserBeatmapsRequest<UserMostPlayedBeatmapsResponse>
|
||||
public class GetUserMostPlayedBeatmapsRequest : APIRequest<List<UserMostPlayedBeatmapsResponse>>
|
||||
{
|
||||
public GetUserMostPlayedBeatmapsRequest(long userID, BeatmapSetType type, int offset = 0)
|
||||
: base(userID, type, offset)
|
||||
private readonly long userId;
|
||||
private readonly int offset;
|
||||
|
||||
public GetUserMostPlayedBeatmapsRequest(long userId, int offset = 0)
|
||||
{
|
||||
if (type != BeatmapSetType.MostPlayed)
|
||||
throw new ArgumentException("Please use " + nameof(GetUserBeatmapsRequest) + " instead");
|
||||
this.userId = userId;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
protected override string Target => $@"users/{userId}/beatmapsets/most_played?offset={offset}";
|
||||
}
|
||||
|
||||
public class UserMostPlayedBeatmapsResponse
|
||||
|
Reference in New Issue
Block a user