osu/osu.Game/Online/Rooms/JoinRoomRequest.cs

32 lines
886 B
C#
Raw Normal View History

// 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 System.Net.Http;
using osu.Framework.IO.Network;
using osu.Game.Online.API;
2020-12-25 04:38:11 +00:00
namespace osu.Game.Online.Rooms
{
public class JoinRoomRequest : APIRequest
{
private readonly Room room;
2021-07-13 05:27:07 +00:00
private readonly string password;
2021-07-13 05:27:07 +00:00
public JoinRoomRequest(Room room, string password)
{
this.room = room;
2021-07-13 05:27:07 +00:00
this.password = password;
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.Method = HttpMethod.Put;
2021-07-13 05:27:07 +00:00
req.AddParameter("password", password);
return req;
}
2021-07-13 05:27:07 +00:00
protected override string Target => $"rooms/{room.RoomID.Value}/users/{User.Id}";
}
}