mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Implement CommentVoteRequest and adjust UI
This commit is contained in:
36
osu.Game/Online/API/Requests/CommentVoteRequest.cs
Normal file
36
osu.Game/Online/API/Requests/CommentVoteRequest.cs
Normal file
@ -0,0 +1,36 @@
|
||||
// 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 osu.Framework.IO.Network;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class CommentVoteRequest : APIRequest<CommentBundle>
|
||||
{
|
||||
private readonly long id;
|
||||
private readonly CommentVoteAction action;
|
||||
|
||||
public CommentVoteRequest(long id, CommentVoteAction action)
|
||||
{
|
||||
this.id = id;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
req.Method = action == CommentVoteAction.Vote ? HttpMethod.Post : HttpMethod.Delete;
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => $@"comments/{id}/vote";
|
||||
}
|
||||
|
||||
public enum CommentVoteAction
|
||||
{
|
||||
Vote,
|
||||
UnVote
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user