mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Squash commits from private fork
Temporary comments left to-remove later
This commit is contained in:
@ -5,11 +5,21 @@ using osu.Framework.IO.Network;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.BeatmapListing;
|
||||
using osu.Game.Rulesets;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class SearchBeatmapSetsRequest : APIRequest<SearchBeatmapSetsResponse>
|
||||
{
|
||||
public class Cursor
|
||||
{
|
||||
[JsonProperty("approved_date")]
|
||||
public string ApprovedDate;
|
||||
|
||||
[JsonProperty("_id")]
|
||||
public string Id;
|
||||
}
|
||||
|
||||
public SearchCategory SearchCategory { get; set; }
|
||||
|
||||
public SortCriteria SortCriteria { get; set; }
|
||||
@ -22,17 +32,20 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
private readonly string query;
|
||||
private readonly RulesetInfo ruleset;
|
||||
private readonly Cursor cursor;
|
||||
|
||||
private string directionString => SortDirection == SortDirection.Descending ? @"desc" : @"asc";
|
||||
|
||||
public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset)
|
||||
public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset, Cursor cursor = null,
|
||||
SearchCategory searchCategory = SearchCategory.Any, SortCriteria sortCriteria = SortCriteria.Ranked, SortDirection sortDirection = SortDirection.Descending)
|
||||
{
|
||||
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
|
||||
this.ruleset = ruleset;
|
||||
this.cursor = cursor;
|
||||
|
||||
SearchCategory = SearchCategory.Any;
|
||||
SortCriteria = SortCriteria.Ranked;
|
||||
SortDirection = SortDirection.Descending;
|
||||
SearchCategory = searchCategory;
|
||||
SortCriteria = sortCriteria;
|
||||
SortDirection = sortDirection;
|
||||
Genre = SearchGenre.Any;
|
||||
Language = SearchLanguage.Any;
|
||||
}
|
||||
@ -55,6 +68,12 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}");
|
||||
|
||||
if (cursor != null)
|
||||
{
|
||||
req.AddParameter("cursor[_id]", cursor.Id);
|
||||
req.AddParameter("cursor[approved_date]", cursor.ApprovedDate);
|
||||
}
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user