mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09: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.IO.Network;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using System.Collections.Generic;
|
using osu.Game.Online.API.Requests;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
|
|
||||||
namespace osu.Game.Extensions
|
namespace osu.Game.Extensions
|
||||||
{
|
{
|
||||||
public class Cursor
|
|
||||||
{
|
|
||||||
[UsedImplicitly]
|
|
||||||
[JsonExtensionData]
|
|
||||||
public IDictionary<string, JToken> Properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class WebRequestExtensions
|
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)
|
public static void AddCursor(this WebRequest webRequest, Cursor cursor)
|
||||||
{
|
{
|
||||||
cursor?.Properties.ForEach(x =>
|
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
|
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")]
|
[JsonProperty("cursor")]
|
||||||
public dynamic CursorJson;
|
public Cursor Cursor;
|
||||||
}
|
|
||||||
|
|
||||||
public abstract class ResponseWithCursor<T> : ResponseWithCursor where T : class
|
|
||||||
{
|
|
||||||
[JsonProperty("cursor")]
|
|
||||||
public T Cursor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Game.Extensions;
|
|
||||||
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 : ResponseWithCursor<Cursor>
|
public class SearchBeatmapSetsResponse : ResponseWithCursor
|
||||||
{
|
{
|
||||||
[JsonProperty("beatmapsets")]
|
[JsonProperty("beatmapsets")]
|
||||||
public IEnumerable<APIBeatmapSet> BeatmapSets;
|
public IEnumerable<APIBeatmapSet> BeatmapSets;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user