2019-01-24 08:43:03 +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.
|
2018-12-22 03:50:37 +00:00
|
|
|
|
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using osu.Framework.IO.Network;
|
2020-07-22 09:29:50 +00:00
|
|
|
|
using osu.Game.Online.API;
|
2018-12-22 03:50:37 +00:00
|
|
|
|
|
2020-12-25 04:38:11 +00:00
|
|
|
|
namespace osu.Game.Online.Rooms
|
2018-12-22 03:50:37 +00:00
|
|
|
|
{
|
2018-12-26 09:38:58 +00:00
|
|
|
|
public class CreateRoomRequest : APIRequest<APICreatedRoom>
|
2018-12-22 03:50:37 +00:00
|
|
|
|
{
|
2020-12-18 16:17:24 +00:00
|
|
|
|
public readonly Room Room;
|
2018-12-22 03:50:37 +00:00
|
|
|
|
|
|
|
|
|
public CreateRoomRequest(Room room)
|
|
|
|
|
{
|
2020-12-18 16:17:24 +00:00
|
|
|
|
Room = room;
|
2018-12-22 03:50:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override WebRequest CreateWebRequest()
|
|
|
|
|
{
|
|
|
|
|
var req = base.CreateWebRequest();
|
|
|
|
|
|
|
|
|
|
req.ContentType = "application/json";
|
|
|
|
|
req.Method = HttpMethod.Post;
|
|
|
|
|
|
2020-12-18 16:17:24 +00:00
|
|
|
|
req.AddRaw(JsonConvert.SerializeObject(Room));
|
2018-12-22 03:50:37 +00:00
|
|
|
|
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Target => "rooms";
|
|
|
|
|
}
|
|
|
|
|
}
|