@@ -230,4 +230,44 @@ public Task<int[][]> Density(string songname, ArcaeaDifficulty difficulty = Arca
230230 => GetDensity ( songname , AuaSongQueryType . SongName , difficulty ) ;
231231
232232 #endregion /data/density
233+
234+ #region /data/challenge
235+
236+ private async Task < string > GetChallenge ( string path , string ? body , long ? timestamp )
237+ {
238+ var qb = new QueryBuilder ( )
239+ . Add ( "path" , path ) ;
240+
241+ if ( body is not null ) qb . Add ( "body" , body ) ;
242+ if ( timestamp is not null ) qb . Add ( "timestamp" , timestamp . ToString ( ) ! ) ;
243+
244+ var response = JsonSerializer . Deserialize < AuaResponse < string > > (
245+ await _client . GetStringAsync ( "data/challenge" + qb . Build ( ) ) ) ! ;
246+ if ( response . Status < 0 )
247+ throw new AuaException ( response . Status , response . Message ! ) ;
248+ return response . Content ! ;
249+ }
250+
251+ /// <summary>
252+ /// Get challenge of a specified arcapi path.
253+ /// </summary>
254+ /// <param name="path">Request arcapi path.</param>
255+ /// <param name="body">Request body, optional when body is empty.</param>
256+ /// <param name="timestamp">Request timestamp.</param>
257+ /// <returns>Challenge string.</returns>
258+ /// <remarks>It is designed for the release version of AUA, and not available for the release version.</remarks>
259+ public Task < string > Challenge ( string path , string ? body = null , long ? timestamp = null )
260+ => GetChallenge ( path , body , timestamp ) ;
261+
262+ /// <summary>
263+ /// Get challenge of a specified arcapi path.
264+ /// </summary>
265+ /// <param name="path">Request arcapi path.</param>
266+ /// <param name="timestamp">Request timestamp.</param>
267+ /// <returns>Challenge string.</returns>
268+ /// <remarks>It is designed for the release version of AUA, and not available for the release version.</remarks>
269+ public Task < string > Challenge ( string path , long ? timestamp = null )
270+ => GetChallenge ( path , null , timestamp ) ;
271+
272+ #endregion /data/challenge
233273}
0 commit comments