1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-27 07:02:54 +08:00
osu-lazer/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs
2022-07-18 08:54:35 +03:00

44 lines
1.2 KiB
C#

// 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.
#nullable disable
using osu.Framework.IO.Network;
using osu.Game.Rulesets;
using osu.Game.Users;
namespace osu.Game.Online.API.Requests
{
public class GetUserRankingsRequest : GetRankingsRequest<GetTopUsersResponse>
{
public readonly UserRankingsType Type;
private readonly CountryCode countryCode;
public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, CountryCode countryCode = CountryCode.Unknown)
: base(ruleset, page)
{
Type = type;
this.countryCode = countryCode;
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
if (countryCode != CountryCode.Unknown)
req.AddParameter("country", countryCode.ToString());
return req;
}
protected override string TargetPostfix() => Type.ToString().ToLowerInvariant();
}
public enum UserRankingsType
{
Performance,
Score
}
}