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);
|
protected override WebRequest CreateWebRequest() => new JsonWebRequest<T>(Uri);
|
||||||
|
|
||||||
|
public T Result => ((JsonWebRequest<T>)WebRequest).ResponseObject;
|
||||||
|
|
||||||
protected APIRequest()
|
protected APIRequest()
|
||||||
{
|
{
|
||||||
base.Success += onSuccess;
|
base.Success += onSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSuccess()
|
private void onSuccess() => Success?.Invoke(Result);
|
||||||
{
|
|
||||||
Success?.Invoke(((JsonWebRequest<T>)WebRequest).ResponseObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked on successful completion of an API request.
|
/// Invoked on successful completion of an API request.
|
||||||
|
|
Loading…
Reference in New Issue