Expose result for synchronous consumption

This commit is contained in:
Dean Herbert 2018-06-08 14:37:48 +09:00
parent b265f02d56
commit 21c8ef576c
1 changed files with 3 additions and 4 deletions

View File

@ -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.