mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 16:32:54 +08:00
Update ranking display to handle new osu-web request format
This commit is contained in:
parent
a4501e8ad5
commit
475815df04
@ -1,12 +1,9 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUsersRequest : APIRequest<List<APIUser>>
|
||||
public class GetUsersRequest : APIRequest<GetUsersResponse>
|
||||
{
|
||||
protected override string Target => @"rankings/osu/performance";
|
||||
}
|
||||
|
15
osu.Game/Online/API/Requests/GetUsersResponse.cs
Normal file
15
osu.Game/Online/API/Requests/GetUsersResponse.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUsersResponse : ResponseWithCursor
|
||||
{
|
||||
[JsonProperty("ranking")]
|
||||
public List<APIUser> Users;
|
||||
}
|
||||
}
|
16
osu.Game/Online/API/Requests/ResponseWithCursor.cs
Normal file
16
osu.Game/Online/API/Requests/ResponseWithCursor.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public abstract class ResponseWithCursor
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of parameters which should be passed to the search endpoint to fetch the next page.
|
||||
/// </summary>
|
||||
[JsonProperty("cursor")]
|
||||
public dynamic CursorJson;
|
||||
}
|
||||
}
|
@ -2,19 +2,12 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class SearchBeatmapSetsResponse
|
||||
public class SearchBeatmapSetsResponse : ResponseWithCursor
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
default:
|
||||
var userRequest = new GetUsersRequest(); // TODO filter arguments!
|
||||
userRequest.Success += response => updateUsers(response.Select(r => r.User));
|
||||
userRequest.Success += res => updateUsers(res.Users.Select(r => r.User));
|
||||
API.Queue(getUsersRequest = userRequest);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user