mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Remove unnecessary generic specification on cursor
This commit is contained in:
parent
c836c9319b
commit
facde2c8e1
@ -3,22 +3,15 @@
|
||||
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Game.Online.API.Requests;
|
||||
|
||||
namespace osu.Game.Extensions
|
||||
{
|
||||
public class Cursor
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, JToken> Properties;
|
||||
}
|
||||
|
||||
public static class WebRequestExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Add a pagination cursor to the web request in the format required by osu-web.
|
||||
/// </summary>
|
||||
public static void AddCursor(this WebRequest webRequest, Cursor cursor)
|
||||
{
|
||||
cursor?.Properties.ForEach(x =>
|
||||
|
20
osu.Game/Online/API/Requests/Cursor.cs
Normal file
20
osu.Game/Online/API/Requests/Cursor.cs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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 JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of parameters which should be passed to the search endpoint to fetch the next page.
|
||||
/// </summary>
|
||||
public class Cursor
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, JToken> Properties;
|
||||
}
|
||||
}
|
@ -7,16 +7,7 @@ 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;
|
||||
}
|
||||
|
||||
public abstract class ResponseWithCursor<T> : ResponseWithCursor where T : class
|
||||
{
|
||||
[JsonProperty("cursor")]
|
||||
public T Cursor;
|
||||
public Cursor Cursor;
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,11 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class SearchBeatmapSetsResponse : ResponseWithCursor<Cursor>
|
||||
public class SearchBeatmapSetsResponse : ResponseWithCursor
|
||||
{
|
||||
[JsonProperty("beatmapsets")]
|
||||
public IEnumerable<APIBeatmapSet> BeatmapSets;
|
||||
|
Loading…
Reference in New Issue
Block a user