1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 11:07:25 +08:00
osu-lazer/osu.Game/Online/API/Requests/PostMessageRequest.cs
2017-04-19 18:46:52 +09:00

33 lines
1012 B
C#

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Extensions;
using osu.Framework.IO.Network;
using osu.Game.Online.Chat;
namespace osu.Game.Online.API.Requests
{
public class PostMessageRequest : APIRequest<Message>
{
private readonly Message message;
public PostMessageRequest(Message message)
{
this.message = message;
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.Method = HttpMethod.POST;
req.AddParameter(@"target_type", message.TargetType.GetDescription());
req.AddParameter(@"target_id", message.TargetId.ToString());
req.AddParameter(@"message", message.Content);
return req;
}
protected override string Target => @"chat/messages";
}
}