2021-03-23 13:44:06 +08: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.
|
|
|
|
|
2021-04-09 14:18:02 +08:00
|
|
|
using System.Globalization;
|
2021-03-23 13:44:06 +08:00
|
|
|
using System.Net.Http;
|
|
|
|
using osu.Framework.IO.Network;
|
|
|
|
using osu.Game.Online.API;
|
|
|
|
using osu.Game.Online.Rooms;
|
|
|
|
|
|
|
|
namespace osu.Game.Online.Solo
|
|
|
|
{
|
|
|
|
public class CreateSoloScoreRequest : APIRequest<APIScoreToken>
|
|
|
|
{
|
|
|
|
private readonly int beatmapId;
|
2021-04-09 14:18:02 +08:00
|
|
|
private readonly int rulesetId;
|
2021-03-23 13:44:06 +08:00
|
|
|
private readonly string versionHash;
|
|
|
|
|
2021-04-09 14:18:02 +08:00
|
|
|
public CreateSoloScoreRequest(int beatmapId, int rulesetId, string versionHash)
|
2021-03-23 13:44:06 +08:00
|
|
|
{
|
|
|
|
this.beatmapId = beatmapId;
|
2021-04-09 14:18:02 +08:00
|
|
|
this.rulesetId = rulesetId;
|
2021-03-23 13:44:06 +08:00
|
|
|
this.versionHash = versionHash;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override WebRequest CreateWebRequest()
|
|
|
|
{
|
|
|
|
var req = base.CreateWebRequest();
|
|
|
|
req.Method = HttpMethod.Post;
|
|
|
|
req.AddParameter("version_hash", versionHash);
|
2021-04-09 14:18:02 +08:00
|
|
|
req.AddParameter("ruleset_id", rulesetId.ToString(CultureInfo.InvariantCulture));
|
2021-03-23 13:44:06 +08:00
|
|
|
return req;
|
|
|
|
}
|
|
|
|
|
2021-04-08 22:15:08 +08:00
|
|
|
protected override string Target => $@"beatmaps/{beatmapId}/solo/scores";
|
2021-03-23 13:44:06 +08:00
|
|
|
}
|
|
|
|
}
|