Bring API request structure up-to-date.

This commit is contained in:
Dean Herbert 2017-04-19 16:02:18 +09:00
parent 3eca32a380
commit 83fa143e17
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
4 changed files with 43 additions and 35 deletions

View File

@ -21,19 +21,16 @@ namespace osu.Game.Online.API.Requests
protected override WebRequest CreateWebRequest() protected override WebRequest CreateWebRequest()
{ {
var req = base.CreateWebRequest(); var req = base.CreateWebRequest();
req.AddParameter(@"c", beatmap.Hash); //req.AddParameter(@"c", beatmap.Hash);
req.AddParameter(@"f", beatmap.Path); //req.AddParameter(@"f", beatmap.Path);
return req; return req;
} }
protected override string Target => @"beatmaps/scores"; protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}/scores";
} }
public class GetScoresResponse public class GetScoresResponse
{ {
[JsonProperty(@"beatmap")]
public BeatmapInfo Beatmap;
[JsonProperty(@"scores")] [JsonProperty(@"scores")]
public IEnumerable<Score> Scores; public IEnumerable<Score> Scores;
} }

View File

@ -19,32 +19,24 @@ namespace osu.Game.Rulesets.Scoring
[JsonProperty(@"score")] [JsonProperty(@"score")]
public double TotalScore { get; set; } public double TotalScore { get; set; }
public double Accuracy { get; set; }
public double Health { get; set; }
[JsonProperty(@"maxcombo")] [JsonProperty(@"accuracy")]
public double Accuracy { get; set; }
public double Health { get; set; } = 1;
[JsonProperty(@"combo")]
public int MaxCombo { get; set; } public int MaxCombo { get; set; }
public int Combo { get; set; } public int Combo { get; set; }
[JsonProperty(@"mods")]
protected string[] ModStrings { get; set; } //todo: parse to Mod objects
public Mod[] Mods { get; set; } public Mod[] Mods { get; set; }
private User user; [JsonProperty(@"user")]
public User User;
public User User
{
get
{
return user ?? new User
{
Username = LegacyUsername,
Id = LegacyUserID
};
}
set
{
user = value;
}
}
[JsonProperty(@"replay_data")] [JsonProperty(@"replay_data")]
public Replay Replay; public Replay Replay;
@ -54,13 +46,7 @@ namespace osu.Game.Rulesets.Scoring
[JsonProperty(@"score_id")] [JsonProperty(@"score_id")]
public long OnlineScoreID; public long OnlineScoreID;
[JsonProperty(@"username")] [JsonProperty(@"created_at")]
public string LegacyUsername;
[JsonProperty(@"user_id")]
public long LegacyUserID;
[JsonProperty(@"date")]
public DateTime Date; public DateTime Date;
/// <summary> /// <summary>

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -14,6 +15,7 @@ namespace osu.Game.Users
/// <summary> /// <summary>
/// The name of this country. /// The name of this country.
/// </summary> /// </summary>
[JsonProperty(@"name")]
public string FullName; public string FullName;
/// <summary> /// <summary>
@ -24,6 +26,7 @@ namespace osu.Game.Users
/// <summary> /// <summary>
/// Two-letter flag acronym (ISO 3166 standard) /// Two-letter flag acronym (ISO 3166 standard)
/// </summary> /// </summary>
[JsonProperty(@"code")]
public string FlagName; public string FlagName;
} }

View File

@ -13,11 +13,33 @@ namespace osu.Game.Users
[JsonProperty(@"username")] [JsonProperty(@"username")]
public string Username; public string Username;
//[JsonProperty(@"country")]
[JsonIgnore]
public Country Country; public Country Country;
public Team Team; //public Team Team;
[JsonProperty(@"colour")] [JsonProperty(@"colour")]
public string Colour; public string Colour;
[JsonProperty(@"avatarUrl")]
public string AvatarUrl;
[JsonProperty(@"cover")]
public UserCover Cover;
public class UserCover
{
[JsonProperty(@"customUrl")]
public string CustomUrl;
[JsonProperty(@"url")]
public string Url;
[JsonProperty(@"id")]
public int? Id;
} }
} }
}