2018-02-26 12:08:37 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
2018-02-25 21:48:39 +08:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
using Humanizer;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
|
|
|
{
|
|
|
|
|
public class GetUserRecentActivitiesRequest : APIRequest<List<RecentActivity>>
|
|
|
|
|
{
|
2018-02-26 01:11:47 +08:00
|
|
|
|
private readonly long userId;
|
|
|
|
|
private readonly int offset;
|
|
|
|
|
|
|
|
|
|
public GetUserRecentActivitiesRequest(long userId, int offset = 0)
|
|
|
|
|
{
|
|
|
|
|
this.userId = userId;
|
|
|
|
|
this.offset = offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Target => $"users/{userId}/recent_activity?offset={offset}";
|
2018-02-25 21:48:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class RecentActivity
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("id")]
|
|
|
|
|
public int ID;
|
|
|
|
|
|
2018-02-26 14:16:16 +08:00
|
|
|
|
[JsonProperty("createdAt")]
|
2018-02-25 21:48:39 +08:00
|
|
|
|
public DateTimeOffset CreatedAt;
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
private string type
|
|
|
|
|
{
|
|
|
|
|
set => Type = (RecentActivityType)Enum.Parse(typeof(RecentActivityType), value.Pascalize());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public RecentActivityType Type;
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
private string scoreRank
|
|
|
|
|
{
|
|
|
|
|
set => ScoreRank = (ScoreRank)Enum.Parse(typeof(ScoreRank), value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ScoreRank ScoreRank;
|
|
|
|
|
|
|
|
|
|
[JsonProperty("rank")]
|
|
|
|
|
public int Rank;
|
|
|
|
|
|
2018-02-26 14:16:16 +08:00
|
|
|
|
[JsonProperty("approval")]
|
|
|
|
|
public BeatmapApproval Approval;
|
|
|
|
|
|
2018-02-26 01:11:47 +08:00
|
|
|
|
[JsonProperty("count")]
|
|
|
|
|
public int Count;
|
|
|
|
|
|
2018-02-25 21:48:39 +08:00
|
|
|
|
[JsonProperty("mode")]
|
|
|
|
|
public string Mode;
|
|
|
|
|
|
|
|
|
|
[JsonProperty("beatmap")]
|
|
|
|
|
public RecentActivityBeatmap Beatmap;
|
|
|
|
|
|
2018-02-26 14:16:16 +08:00
|
|
|
|
[JsonProperty("beatmapset")]
|
|
|
|
|
public RecentActivityBeatmap Beatmapset;
|
|
|
|
|
|
2018-02-25 21:48:39 +08:00
|
|
|
|
[JsonProperty("user")]
|
|
|
|
|
public RecentActivityUser User;
|
|
|
|
|
|
2018-02-26 15:38:12 +08:00
|
|
|
|
[JsonProperty("achievement")]
|
|
|
|
|
public RecentActivityAchievement Achievement;
|
2018-02-26 01:11:47 +08:00
|
|
|
|
|
2018-02-25 21:48:39 +08:00
|
|
|
|
public class RecentActivityBeatmap
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("title")]
|
|
|
|
|
public string Title;
|
|
|
|
|
|
|
|
|
|
[JsonProperty("url")]
|
|
|
|
|
public string Url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class RecentActivityUser
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("username")]
|
|
|
|
|
public string Username;
|
|
|
|
|
|
|
|
|
|
[JsonProperty("url")]
|
|
|
|
|
public string Url;
|
2018-02-26 01:11:47 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty("previousUsername")]
|
|
|
|
|
public string PreviousUsername;
|
2018-02-25 21:48:39 +08:00
|
|
|
|
}
|
2018-02-26 15:38:12 +08:00
|
|
|
|
|
|
|
|
|
public class RecentActivityAchievement
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("slug")]
|
|
|
|
|
public string Slug;
|
|
|
|
|
|
|
|
|
|
[JsonProperty("name")]
|
|
|
|
|
public string Name;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-25 21:48:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum RecentActivityType
|
|
|
|
|
{
|
|
|
|
|
Achievement,
|
|
|
|
|
BeatmapPlaycount,
|
|
|
|
|
BeatmapsetApprove,
|
|
|
|
|
BeatmapsetDelete,
|
|
|
|
|
BeatmapsetRevive,
|
|
|
|
|
BeatmapsetUpdate,
|
2018-02-26 01:11:47 +08:00
|
|
|
|
BeatmapsetUpload,
|
2018-02-25 21:48:39 +08:00
|
|
|
|
Medal,
|
|
|
|
|
Rank,
|
|
|
|
|
RankLost,
|
|
|
|
|
UserSupportAgain,
|
|
|
|
|
UserSupportFirst,
|
|
|
|
|
UserSupportGift,
|
|
|
|
|
UsernameChange,
|
|
|
|
|
}
|
2018-02-26 14:16:16 +08:00
|
|
|
|
|
|
|
|
|
public enum BeatmapApproval
|
|
|
|
|
{
|
|
|
|
|
Ranked,
|
|
|
|
|
Approved,
|
|
|
|
|
Qualified,
|
|
|
|
|
}
|
2018-02-25 21:48:39 +08:00
|
|
|
|
}
|