1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 16:48:22 +08:00
osu-lazer/osu.Game/Online/API/Requests/ChatReportRequest.cs

39 lines
1.1 KiB
C#
Raw Normal View History

2023-03-22 23:13:24 +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.Overlays.Chat;
2023-05-03 17:51:02 +08:00
namespace osu.Game.Online.API.Requests
2023-03-22 23:13:24 +08:00
{
2023-05-03 17:51:02 +08:00
public class ChatReportRequest : APIRequest
2023-03-22 23:13:24 +08:00
{
2023-05-03 17:51:02 +08:00
public readonly long? MessageId;
public readonly ChatReportReason Reason;
public readonly string Comment;
public ChatReportRequest(long? id, ChatReportReason reason, string comment)
{
MessageId = id;
Reason = reason;
Comment = comment;
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.Method = HttpMethod.Post;
req.AddParameter(@"reportable_type", @"message");
req.AddParameter(@"reportable_id", $"{MessageId}");
req.AddParameter(@"reason", Reason.ToString());
req.AddParameter(@"comments", Comment);
return req;
}
protected override string Target => @"reports";
2023-03-22 23:13:24 +08:00
}
}