mirror of https://github.com/ppy/osu
Expose result for synchronous consumption
This commit is contained in:
parent
b265f02d56
commit
21c8ef576c
|
@ -14,15 +14,14 @@ public abstract class APIRequest<T> : APIRequest
|
|||
{
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue