1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-30 18:07:25 +08:00
osu-lazer/osu.Game/Online/API/Requests/CommentPostRequest.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.4 KiB
C#
Raw Normal View History

2023-01-07 04:31:19 +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.
using System.Net.Http;
using osu.Framework.IO.Network;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests
{
public class CommentPostRequest : APIRequest<CommentBundle>
{
public readonly CommentableType Commentable;
public readonly long CommentableId;
public readonly string Message;
public readonly long? ReplyTo;
public CommentPostRequest(CommentableType commentable, long commentableId, string message, long? replyTo = null)
{
Commentable = commentable;
CommentableId = commentableId;
Message = message;
ReplyTo = replyTo;
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.Method = HttpMethod.Post;
req.AddParameter(@"comment[commentable_type]", Commentable.ToString());
req.AddParameter(@"comment[commentable_id]", $"{CommentableId}");
req.AddParameter(@"comment[message]", Message);
if (ReplyTo.HasValue)
req.AddParameter(@"comment[parent_id]", $"{ReplyTo}");
return req;
}
protected override string Target => "comments";
}
}