/// <summary> /// Executes the request asynchronously without parsing the response, /// and calls the specified method once finished. /// </summary> /// <remarks>The returned stream is encoded in UTF-8.</remarks> public void FetchAsyncAsStream([Optional] ExecuteRequestDelegate <Stream> methodToCall) { GetAsyncResponse( (IAsyncRequestResult state) => { var result = new LazyResult <Stream>( () => { // Retrieve and convert the response. IResponse response = state.GetResponse(); response.ThrowIfNull("response"); return(response.Stream); }); // Only invoke the method if it was set. if (methodToCall != null) { methodToCall(result); } else { result.GetResult(); // Resolve the result in any case. } }); }
/// <summary> /// Executes the request asynchronously and optionally calls the specified method once finished. /// </summary> public void FetchAsync([Optional] ExecuteRequestDelegate <TResponse> methodToCall) { GetAsyncResponse( (IAsyncRequestResult state) => { var result = new LazyResult <TResponse>(() => { // Retrieve and convert the response. IResponse response = state.GetResponse(); return(FetchObject(response)); }); // Only invoke the method if it was set. if (methodToCall != null) { methodToCall(result); } else { result.GetResult(); } }); }
public void FetchAsyncAsStream(ExecuteRequestDelegate <System.IO.Stream> methodToCall = null) { throw new NotImplementedException(); }