2020-05-13 15:04:31 +00:00
|
|
|
|
// 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 osu.Framework.IO.Network;
|
2020-05-12 20:04:39 +00:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
2020-05-14 07:01:07 +00:00
|
|
|
|
using osu.Game.Online.API.Requests;
|
2020-05-12 20:04:39 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Extensions
|
|
|
|
|
{
|
|
|
|
|
public static class WebRequestExtensions
|
|
|
|
|
{
|
2020-05-14 07:01:07 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Add a pagination cursor to the web request in the format required by osu-web.
|
|
|
|
|
/// </summary>
|
2020-05-12 20:04:39 +00:00
|
|
|
|
public static void AddCursor(this WebRequest webRequest, Cursor cursor)
|
|
|
|
|
{
|
|
|
|
|
cursor?.Properties.ForEach(x =>
|
|
|
|
|
{
|
|
|
|
|
webRequest.AddParameter("cursor[" + x.Key + "]", x.Value.ToString());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|