1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 04:17:25 +08:00
osu-lazer/osu.Game/Online/API/Requests/Responses/APIKudosuHistory.cs

84 lines
1.8 KiB
C#
Raw Normal View History

2019-08-09 15:47:52 +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.
using System;
using System.Linq;
2019-08-09 15:47:52 +08:00
using Newtonsoft.Json;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIKudosuHistory
{
2019-08-09 16:19:14 +08:00
[JsonProperty("created_at")]
2019-08-09 15:47:52 +08:00
public DateTimeOffset CreatedAt;
[JsonProperty("amount")]
public int Amount;
2019-08-19 02:27:53 +08:00
[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;
}
public KudosuSource Source;
public KudosuAction Action;
2019-08-19 02:27:53 +08:00
[JsonProperty("action")]
private string action
{
set
{
// incoming action may contain a prefix. if it doesn't, it's a legacy forum event.
string[] split = value.Split('.');
2019-08-19 02:27:53 +08:00
if (split.Length > 1)
Enum.TryParse(split.First().Replace("_", ""), true, out Source);
else
Source = KudosuSource.Forum;
Enum.TryParse(split.Last(), true, out Action);
2019-08-19 02:27:53 +08:00
}
}
}
2019-08-19 02:27:53 +08:00
public enum KudosuSource
{
Unknown,
AllowKudosu,
Delete,
DenyKudosu,
Forum,
Recalculate,
Restore,
Vote
2019-08-09 15:47:52 +08:00
}
2019-09-02 14:57:55 +08:00
public enum KudosuAction
{
Give,
Reset,
Revoke,
2019-09-02 14:57:55 +08:00
}
2019-08-09 15:47:52 +08:00
}