mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 04:05:35 +08:00
Expand APIKudosuHistory
This commit is contained in:
parent
550dcee60d
commit
2393bbc69b
@ -18,4 +18,14 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
protected override string Target => $"users/{userId}/kudosu";
|
||||
}
|
||||
|
||||
public enum KudosuAction
|
||||
{
|
||||
Give,
|
||||
VoteGive,
|
||||
Reset,
|
||||
VoteReset,
|
||||
DenyKudosuReset,
|
||||
Revoke,
|
||||
}
|
||||
}
|
||||
|
@ -2,19 +2,59 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using Humanizer;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APIKudosuHistory
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public int ID;
|
||||
|
||||
[JsonProperty("created_at")]
|
||||
public DateTimeOffset CreatedAt;
|
||||
|
||||
[JsonProperty("amount")]
|
||||
private int amount
|
||||
{
|
||||
set => Amount = Math.Abs(value);
|
||||
}
|
||||
|
||||
public int Amount;
|
||||
|
||||
[JsonProperty("post")]
|
||||
public ModdingPost Post;
|
||||
|
||||
public class ModdingPost
|
||||
{
|
||||
[JsonProperty("url")]
|
||||
public string Url;
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string Title;
|
||||
}
|
||||
|
||||
[JsonProperty("giver")]
|
||||
public KudosuGiver Giver;
|
||||
|
||||
public class KudosuGiver
|
||||
{
|
||||
[JsonProperty("url")]
|
||||
public string Url;
|
||||
|
||||
[JsonProperty("username")]
|
||||
public string Username;
|
||||
}
|
||||
|
||||
[JsonProperty("action")]
|
||||
private string action
|
||||
{
|
||||
set
|
||||
{
|
||||
string parsed = value.Contains(".") ? value.Split('.')[0].Pascalize() + value.Split('.')[1].Pascalize() : value.Pascalize();
|
||||
|
||||
Action = (KudosuAction)Enum.Parse(typeof(KudosuAction), parsed);
|
||||
}
|
||||
}
|
||||
|
||||
public KudosuAction Action;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user