From 111541fe7add521e40a6e9d90cd92f16f449d050 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Mon, 15 Jul 2019 13:31:57 +0300 Subject: [PATCH] Use limit in requests --- osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs | 6 ++++-- .../Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs | 6 ++++-- .../Online/API/Requests/GetUserRecentActivitiesRequest.cs | 6 ++++-- osu.Game/Online/API/Requests/GetUserScoresRequest.cs | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index 45d751f00e..57005181ca 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -11,17 +11,19 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; private readonly int offset; + private readonly int limit; 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.offset = offset; + this.limit = limit; this.type = type; } // 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 diff --git a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs index 40e52bdaf6..fccb27a86c 100644 --- a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs @@ -10,13 +10,15 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; 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.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}"; } } diff --git a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs index 9f80180e70..d066636911 100644 --- a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs @@ -10,14 +10,16 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; 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.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 diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs index 48a43bbbad..e81686b9fe 100644 --- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs @@ -11,16 +11,18 @@ namespace osu.Game.Online.API.Requests private readonly long userId; private readonly ScoreType type; 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.type = type; this.offset = offset; + this.offset = limit; } // 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