2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 16:43:03 +08:00
|
|
|
|
// 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 Newtonsoft.Json;
|
|
|
|
|
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
|
|
|
|
{
|
2018-12-26 17:38:58 +08:00
|
|
|
|
public class CreateRoomRequest : APIRequest<APICreatedRoom>
|
2018-12-22 11:50:37 +08:00
|
|
|
|
{
|
2020-12-19 00:17:24 +08:00
|
|
|
|
public readonly Room Room;
|
2018-12-22 11:50:37 +08:00
|
|
|
|
|
|
|
|
|
public CreateRoomRequest(Room room)
|
|
|
|
|
{
|
2020-12-19 00:17:24 +08:00
|
|
|
|
Room = room;
|
2018-12-22 11:50:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override WebRequest CreateWebRequest()
|
|
|
|
|
{
|
|
|
|
|
var req = base.CreateWebRequest();
|
|
|
|
|
|
|
|
|
|
req.ContentType = "application/json";
|
|
|
|
|
req.Method = HttpMethod.Post;
|
|
|
|
|
|
2020-12-19 00:17:24 +08:00
|
|
|
|
req.AddRaw(JsonConvert.SerializeObject(Room));
|
2018-12-22 11:50:37 +08:00
|
|
|
|
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Target => "rooms";
|
|
|
|
|
}
|
|
|
|
|
}
|