2019-01-24 16:43:03 +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.
|
2018-12-22 11:50:37 +08:00
|
|
|
|
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using osu.Framework.IO.Network;
|
2020-07-22 17:29:50 +08:00
|
|
|
|
using osu.Game.Online.API;
|
2018-12-22 11:50:37 +08:00
|
|
|
|
|
2020-12-25 12:38:11 +08:00
|
|
|
|
namespace osu.Game.Online.Rooms
|
2018-12-22 11:50:37 +08:00
|
|
|
|
{
|
|
|
|
|
public class JoinRoomRequest : APIRequest
|
|
|
|
|
{
|
2021-07-19 18:55:08 +08:00
|
|
|
|
public readonly Room Room;
|
2023-06-24 23:11:38 +08:00
|
|
|
|
public readonly string? Password;
|
2018-12-22 11:50:37 +08:00
|
|
|
|
|
2023-06-24 23:11:38 +08:00
|
|
|
|
public JoinRoomRequest(Room room, string? password)
|
2018-12-22 11:50:37 +08:00
|
|
|
|
{
|
2021-07-19 18:55:08 +08:00
|
|
|
|
Room = room;
|
|
|
|
|
Password = password;
|
2018-12-22 11:50:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override WebRequest CreateWebRequest()
|
|
|
|
|
{
|
|
|
|
|
var req = base.CreateWebRequest();
|
|
|
|
|
req.Method = HttpMethod.Put;
|
2021-07-24 18:21:16 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(Password))
|
|
|
|
|
req.AddParameter(@"password", Password, RequestParameterType.Query);
|
2018-12-22 11:50:37 +08:00
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-30 17:21:30 +08:00
|
|
|
|
protected override string Target => $@"rooms/{Room.RoomID.Value}/users/{User!.Id}";
|
2018-12-22 11:50:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|