diff --git a/CryptoExchange.Net/Objects/CallResult.cs b/CryptoExchange.Net/Objects/CallResult.cs index 5ee63bd..c321890 100644 --- a/CryptoExchange.Net/Objects/CallResult.cs +++ b/CryptoExchange.Net/Objects/CallResult.cs @@ -273,6 +273,28 @@ namespace CryptoExchange.Net.Objects return new WebCallResult(ResponseStatusCode, ResponseHeaders, ResponseTime, RequestId, RequestUrl, RequestBody, RequestMethod, RequestHeaders, error); } + /// + /// Copy the WebCallResult to a new data type + /// + /// The new type + /// The data of the new type + /// + public WebCallResult As([AllowNull] K data) + { + return new WebCallResult(ResponseStatusCode, ResponseHeaders, ResponseTime, 0, null, RequestId, RequestUrl, RequestBody, RequestMethod, RequestHeaders, ResultDataSource.Server, data, Error); + } + + /// + /// Copy the WebCallResult to a new data type + /// + /// The new type + /// The error returned + /// + public WebCallResult AsError(Error error) + { + return new WebCallResult(ResponseStatusCode, ResponseHeaders, ResponseTime, 0, null, RequestId, RequestUrl, RequestBody, RequestMethod, RequestHeaders, ResultDataSource.Server, default, error); + } + /// public override string ToString() {