mirror of
https://github.com/ppy/osu
synced 2024-12-14 19:06:07 +00:00
Add request class
This commit is contained in:
parent
c65a8a83f3
commit
7251d41deb
39
osu.Game/Online/API/Requests/CommentReportRequest.cs
Normal file
39
osu.Game/Online/API/Requests/CommentReportRequest.cs
Normal file
@ -0,0 +1,39 @@
|
||||
// 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.Comments;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class CommentReportRequest : APIRequest
|
||||
{
|
||||
public readonly long CommentID;
|
||||
public readonly CommentReportReason Reason;
|
||||
public readonly string? Info;
|
||||
|
||||
public CommentReportRequest(long commentID, CommentReportReason reason, string? info)
|
||||
{
|
||||
CommentID = commentID;
|
||||
Reason = reason;
|
||||
Info = info;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
req.Method = HttpMethod.Post;
|
||||
|
||||
req.AddParameter(@"reportable_type", @"comment");
|
||||
req.AddParameter(@"reportable_id", $"{CommentID}");
|
||||
req.AddParameter(@"reason", Reason.ToString());
|
||||
if (!string.IsNullOrWhiteSpace(Info))
|
||||
req.AddParameter(@"comments", Info);
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => @"reports";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user