mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Update ranking display to handle new osu-web request format
This commit is contained in:
@ -1,12 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// 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
|
namespace osu.Game.Online.API.Requests
|
||||||
{
|
{
|
||||||
public class GetUsersRequest : APIRequest<List<APIUser>>
|
public class GetUsersRequest : APIRequest<GetUsersResponse>
|
||||||
{
|
{
|
||||||
protected override string Target => @"rankings/osu/performance";
|
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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests
|
namespace osu.Game.Online.API.Requests
|
||||||
{
|
{
|
||||||
public class SearchBeatmapSetsResponse
|
public class SearchBeatmapSetsResponse : ResponseWithCursor
|
||||||
{
|
{
|
||||||
public IEnumerable<APIBeatmapSet> BeatmapSets;
|
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:
|
default:
|
||||||
var userRequest = new GetUsersRequest(); // TODO filter arguments!
|
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);
|
API.Queue(getUsersRequest = userRequest);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user