mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Use limit in requests
This commit is contained in:
@ -11,17 +11,19 @@ namespace osu.Game.Online.API.Requests
|
|||||||
{
|
{
|
||||||
private readonly long userId;
|
private readonly long userId;
|
||||||
private readonly int offset;
|
private readonly int offset;
|
||||||
|
private readonly int limit;
|
||||||
private readonly BeatmapSetType type;
|
private readonly BeatmapSetType type;
|
||||||
|
|
||||||
public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0)
|
public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0, int limit = 6)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
this.limit = limit;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||||
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}?offset={offset}";
|
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}?offset={offset}&limit={limit}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum BeatmapSetType
|
public enum BeatmapSetType
|
||||||
|
@ -10,13 +10,15 @@ namespace osu.Game.Online.API.Requests
|
|||||||
{
|
{
|
||||||
private readonly long userId;
|
private readonly long userId;
|
||||||
private readonly int offset;
|
private readonly int offset;
|
||||||
|
private readonly int limit;
|
||||||
|
|
||||||
public GetUserMostPlayedBeatmapsRequest(long userId, int offset = 0)
|
public GetUserMostPlayedBeatmapsRequest(long userId, int offset = 0, int limit = 5)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
this.limit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string Target => $@"users/{userId}/beatmapsets/most_played?offset={offset}";
|
protected override string Target => $@"users/{userId}/beatmapsets/most_played?offset={offset}&limit={limit}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,16 @@ namespace osu.Game.Online.API.Requests
|
|||||||
{
|
{
|
||||||
private readonly long userId;
|
private readonly long userId;
|
||||||
private readonly int offset;
|
private readonly int offset;
|
||||||
|
private readonly int limit;
|
||||||
|
|
||||||
public GetUserRecentActivitiesRequest(long userId, int offset = 0)
|
public GetUserRecentActivitiesRequest(long userId, int offset = 0, int limit = 5)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
this.limit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string Target => $"users/{userId}/recent_activity?offset={offset}";
|
protected override string Target => $"users/{userId}/recent_activity?offset={offset}&limit={limit}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RecentActivityType
|
public enum RecentActivityType
|
||||||
|
@ -11,16 +11,18 @@ namespace osu.Game.Online.API.Requests
|
|||||||
private readonly long userId;
|
private readonly long userId;
|
||||||
private readonly ScoreType type;
|
private readonly ScoreType type;
|
||||||
private readonly int offset;
|
private readonly int offset;
|
||||||
|
private readonly int limit;
|
||||||
|
|
||||||
public GetUserScoresRequest(long userId, ScoreType type, int offset = 0)
|
public GetUserScoresRequest(long userId, ScoreType type, int offset = 0, int limit = 5)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
this.offset = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||||
protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLowerInvariant()}?offset={offset}";
|
protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLowerInvariant()}?offset={offset}&limit={limit}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ScoreType
|
public enum ScoreType
|
||||||
|
Reference in New Issue
Block a user