mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Merge branch 'master' into sharpen
This commit is contained in:
36
osu.Game/Online/API/Requests/PostBeatmapFavouriteRequest.cs
Normal file
36
osu.Game/Online/API/Requests/PostBeatmapFavouriteRequest.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 System.Net.Http;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class PostBeatmapFavouriteRequest : APIRequest
|
||||
{
|
||||
private readonly int id;
|
||||
private readonly BeatmapFavouriteAction action;
|
||||
|
||||
public PostBeatmapFavouriteRequest(int id, BeatmapFavouriteAction action)
|
||||
{
|
||||
this.id = id;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
req.Method = HttpMethod.Post;
|
||||
req.AddParameter(@"action", action.ToString().ToLowerInvariant());
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => $@"beatmapsets/{id}/favourites";
|
||||
}
|
||||
|
||||
public enum BeatmapFavouriteAction
|
||||
{
|
||||
Favourite,
|
||||
UnFavourite
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset, BeatmapSearchCategory searchCategory = BeatmapSearchCategory.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending)
|
||||
{
|
||||
this.query = System.Uri.EscapeDataString(query);
|
||||
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
|
||||
this.ruleset = ruleset;
|
||||
this.searchCategory = searchCategory;
|
||||
this.sortCriteria = sortCriteria;
|
||||
|
Reference in New Issue
Block a user