diff --git a/ArcaeaUnlimitedAPI.Lib/Core/AuaDataApi.cs b/ArcaeaUnlimitedAPI.Lib/Core/AuaDataApi.cs index 0dec6d1..f799368 100644 --- a/ArcaeaUnlimitedAPI.Lib/Core/AuaDataApi.cs +++ b/ArcaeaUnlimitedAPI.Lib/Core/AuaDataApi.cs @@ -14,6 +14,8 @@ public AuaDataApi(HttpClient client) _client = client; } + #region /data/update + private async Task GetUpdate() { var response = JsonSerializer.Deserialize>( @@ -30,6 +32,10 @@ private async Task GetUpdate() /// Update content with url and version public Task Update() => GetUpdate(); + #endregion /data/update + + #region /data/playdata + private static async Task GetPlaydata(HttpClient client, string songname, AuaSongQueryType queryType, ArcaeaDifficulty difficulty, int? startInt, int? endInt, double? startDouble, double? endDouble) @@ -130,4 +136,98 @@ public async Task Playdata(string songname, int start, int public async Task Playdata(string songname, double start, double end) => await GetPlaydata(_client, songname, AuaSongQueryType.SongName, ArcaeaDifficulty.Future, null, null, start, end); + + #endregion /data/playdata + + #region /data/theory + + private async Task GetTheory(string version, + int overflow, AuaReplyWith replyWith) + { + var qb = new QueryBuilder() + .Add("version", version) + .Add("overflow", overflow.ToString()); + + if (replyWith.HasFlag(AuaReplyWith.Recent)) + qb.Add("withrecent", "true"); + if (replyWith.HasFlag(AuaReplyWith.SongInfo)) + qb.Add("withsonginfo", "true"); + + var response = JsonSerializer.Deserialize>( + await _client.GetStringAsync("data/theory" + qb.Build()))!; + if (response.Status < 0) + throw new AuaException(response.Status, response.Message!); + return response.Content!; + } + + /// + /// Get the highest best30 scores in a specified version of Arcaea. + /// + /// /data/theory + /// The version of Arcaea, formatted like 4.0 + /// The number of the overflow records below the best30 minimum, range 0-10 + /// Additional information to reply with. Supports songinfo and recent. + /// + public Task Theory(string version, + int overflow = 0, AuaReplyWith replyWith = AuaReplyWith.None) + => GetTheory(version, overflow, replyWith); + + #endregion /data/theory + + #region /data/density + + private async Task GetDensity(string songname, AuaSongQueryType queryType, ArcaeaDifficulty difficulty) + { + var qb = new QueryBuilder() + .Add(queryType == AuaSongQueryType.SongId ? "songid" : "songname", songname); + qb.Add("difficulty", ((int)difficulty).ToString()); + + var response = JsonSerializer.Deserialize>( + await _client.GetStringAsync("data/theory" + qb.Build()))!; + if (response.Status < 0) + throw new AuaException(response.Status, response.Message!); + return response.Content!; + } + + /// + /// Get song play density. + /// + /// /data/density + /// Any song name for fuzzy querying or sid in Arcaea songlist + /// Specify the query type between songname and songid + /// Song difficulty + /// + /// A data array.
+ /// The each sub-array in the data contains 3 items: + /// + /// Formatted score (score / 10000) + /// Formatted potential (potential / 10) + /// User count + /// + ///
+ /// It is a large data set, so it is not recommended to use this API frequently. + public Task Density(string songname, AuaSongQueryType queryType = AuaSongQueryType.SongName, + ArcaeaDifficulty difficulty = ArcaeaDifficulty.Future) + => GetDensity(songname, queryType, difficulty); + + /// + /// Get song play density. + /// + /// /data/density + /// Any song name for fuzzy querying or sid in Arcaea songlist + /// Song difficulty + /// + /// A data array.
+ /// The each sub-array in the data contains 3 items: + /// + /// Formatted score (score / 10000) + /// Formatted potential (potential / 10) + /// User count + /// + ///
+ /// It is a large data set, so it is not recommended to use this API frequently. + public Task Density(string songname, ArcaeaDifficulty difficulty = ArcaeaDifficulty.Future) + => GetDensity(songname, AuaSongQueryType.SongName, difficulty); + + #endregion /data/density } \ No newline at end of file