1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 13:37:25 +08:00

Expose result for synchronous consumption

This commit is contained in:
Dean Herbert 2018-06-08 14:37:48 +09:00
parent b265f02d56
commit 21c8ef576c

View File

@ -14,15 +14,14 @@ namespace osu.Game.Online.API
{
protected override WebRequest CreateWebRequest() => new JsonWebRequest<T>(Uri);
public T Result => ((JsonWebRequest<T>)WebRequest).ResponseObject;
protected APIRequest()
{
base.Success += onSuccess;
}
private void onSuccess()
{
Success?.Invoke(((JsonWebRequest<T>)WebRequest).ResponseObject);
}
private void onSuccess() => Success?.Invoke(Result);
/// <summary>
/// Invoked on successful completion of an API request.