1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 01:42:54 +08:00
osu-lazer/osu.Game/Online/Solo/CreateSoloScoreRequest.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.3 KiB
C#
Raw Normal View History

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