1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 14:12:54 +08:00
osu-lazer/osu.Game/Online/API/Requests/PostBeatmapFavouriteRequest.cs

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

40 lines
1.0 KiB
C#
Raw Normal View History

2019-10-07 20:36:23 +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.
2022-06-17 15:37:17 +08:00
#nullable disable
2019-10-07 20:36:23 +08:00
using osu.Framework.IO.Network;
using System.Net.Http;
namespace osu.Game.Online.API.Requests
{
public class PostBeatmapFavouriteRequest : APIRequest
{
2021-10-23 05:11:31 +08:00
public readonly BeatmapFavouriteAction Action;
2019-10-07 20:36:23 +08:00
private readonly int id;
public PostBeatmapFavouriteRequest(int id, BeatmapFavouriteAction action)
{
this.id = id;
2021-10-23 05:11:31 +08:00
Action = action;
2019-10-07 20:36:23 +08:00
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.Method = HttpMethod.Post;
2021-10-23 05:11:31 +08:00
req.AddParameter(@"action", Action.ToString().ToLowerInvariant());
2019-10-07 20:36:23 +08:00
return req;
}
protected override string Target => $@"beatmapsets/{id}/favourites";
}
public enum BeatmapFavouriteAction
{
Favourite,
UnFavourite
}
}