2021-03-23 05:44:06 +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.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-04-09 06:18:02 +00:00
|
|
|
using System.Globalization;
|
2021-03-23 05:44:06 +00:00
|
|
|
using System.Net.Http;
|
|
|
|
using osu.Framework.IO.Network;
|
2022-07-02 03:16:16 +00:00
|
|
|
using osu.Game.Beatmaps;
|
2021-03-23 05:44:06 +00:00
|
|
|
using osu.Game.Online.API;
|
|
|
|
using osu.Game.Online.Rooms;
|
|
|
|
|
|
|
|
namespace osu.Game.Online.Solo
|
|
|
|
{
|
|
|
|
public class CreateSoloScoreRequest : APIRequest<APIScoreToken>
|
|
|
|
{
|
2022-07-02 03:16:16 +00:00
|
|
|
private readonly BeatmapInfo beatmapInfo;
|
2021-04-09 06:18:02 +00:00
|
|
|
private readonly int rulesetId;
|
2021-03-23 05:44:06 +00:00
|
|
|
private readonly string versionHash;
|
|
|
|
|
2022-07-02 03:16:16 +00:00
|
|
|
public CreateSoloScoreRequest(BeatmapInfo beatmapInfo, int rulesetId, string versionHash)
|
2021-03-23 05:44:06 +00:00
|
|
|
{
|
2022-07-02 03:16:16 +00:00
|
|
|
this.beatmapInfo = beatmapInfo;
|
2021-04-09 06:18:02 +00:00
|
|
|
this.rulesetId = rulesetId;
|
2021-03-23 05:44:06 +00:00
|
|
|
this.versionHash = versionHash;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override WebRequest CreateWebRequest()
|
|
|
|
{
|
|
|
|
var req = base.CreateWebRequest();
|
|
|
|
req.Method = HttpMethod.Post;
|
|
|
|
req.AddParameter("version_hash", versionHash);
|
2022-07-02 03:16:16 +00:00
|
|
|
req.AddParameter("beatmap_hash", beatmapInfo.MD5Hash);
|
2021-04-09 06:18:02 +00:00
|
|
|
req.AddParameter("ruleset_id", rulesetId.ToString(CultureInfo.InvariantCulture));
|
2021-03-23 05:44:06 +00:00
|
|
|
return req;
|
|
|
|
}
|
|
|
|
|
2022-07-02 03:16:16 +00:00
|
|
|
protected override string Target => $@"beatmaps/{beatmapInfo.OnlineID}/solo/scores";
|
2021-03-23 05:44:06 +00:00
|
|
|
}
|
|
|
|
}
|