mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Update beatmap search API to match latest osu-web structure
This commit is contained in:
@ -1,16 +1,14 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Direct;
|
using osu.Game.Overlays.Direct;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests
|
namespace osu.Game.Online.API.Requests
|
||||||
{
|
{
|
||||||
public class SearchBeatmapSetsRequest : APIRequest<IEnumerable<APIBeatmapSet>>
|
public class SearchBeatmapSetsRequest : APIRequest<SearchBeatmapSetsResponse>
|
||||||
{
|
{
|
||||||
private readonly string query;
|
private readonly string query;
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
@ -35,6 +33,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
public enum BeatmapSearchCategory
|
public enum BeatmapSearchCategory
|
||||||
{
|
{
|
||||||
Any = 7,
|
Any = 7,
|
||||||
|
|
||||||
[Description("Ranked & Approved")]
|
[Description("Ranked & Approved")]
|
||||||
RankedApproved = 0,
|
RankedApproved = 0,
|
||||||
Approved = 1,
|
Approved = 1,
|
||||||
@ -43,6 +42,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
Qualified = 3,
|
Qualified = 3,
|
||||||
Pending = 4,
|
Pending = 4,
|
||||||
Graveyard = 5,
|
Graveyard = 5,
|
||||||
|
|
||||||
[Description("My Maps")]
|
[Description("My Maps")]
|
||||||
MyMaps = 6,
|
MyMaps = 6,
|
||||||
}
|
}
|
||||||
|
20
osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs
Normal file
20
osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.API.Requests
|
||||||
|
{
|
||||||
|
public class SearchBeatmapSetsResponse
|
||||||
|
{
|
||||||
|
public IEnumerable<APIBeatmapSet> BeatmapSets;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A collection of parameters which should be passed to the search endpoint to fetch the next page.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("cursor")]
|
||||||
|
public dynamic CursorJson;
|
||||||
|
}
|
||||||
|
}
|
@ -288,7 +288,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var sets = response.Select(r => r.ToBeatmapSet(rulesets)).ToList();
|
var sets = response.BeatmapSets.Select(r => r.ToBeatmapSet(rulesets)).ToList();
|
||||||
|
|
||||||
// may not need scheduling; loads async internally.
|
// may not need scheduling; loads async internally.
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
|
Reference in New Issue
Block a user