// ReSharper disable once UnusedMember.Global public static async Task <IReadOnlyDictionary <string, CandlesHistoryResponseModel> > TryGetCandlesHistoryBatchAsync( this ICandleshistoryservice service, IList <string> assetPairs, CandlePriceType priceType, CandleTimeInterval timeInterval, DateTime fromMoment, DateTime toMoment, CancellationToken cancellationToken = default(CancellationToken)) { var result = await service.GetCandlesHistoryBatchOrErrorAsync(new GetCandlesHistoryBatchRequest(priceType, timeInterval, fromMoment, toMoment, assetPairs), cancellationToken); return(result as IReadOnlyDictionary <string, CandlesHistoryResponseModel>); }
// ReSharper disable once UnusedMember.Global public static async Task <IReadOnlyDictionary <string, CandlesHistoryResponseModel> > GetCandlesHistoryBatchAsync( this ICandleshistoryservice service, IList <string> assetPairs, CandlePriceType priceType, CandleTimeInterval timeInterval, DateTime fromMoment, DateTime toMoment, CancellationToken cancellationToken = default(CancellationToken)) { var result = await service.GetCandlesHistoryBatchOrErrorAsync(new GetCandlesHistoryBatchRequest(priceType, timeInterval, fromMoment, toMoment, assetPairs), cancellationToken); switch (result) { case IReadOnlyDictionary <string, CandlesHistoryResponseModel> candlesHistoryResponseModel: return(candlesHistoryResponseModel); case ErrorResponse errorResponse: throw new ErrorResponseException(errorResponse); } throw new InvalidOperationException($"Unexpected response type: {result?.GetType()}"); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='request'> /// </param> public static object GetCandlesHistoryBatchOrError(this ICandleshistoryservice operations, GetCandlesHistoryBatchRequest request = default(GetCandlesHistoryBatchRequest)) { return(operations.GetCandlesHistoryBatchOrErrorAsync(request).GetAwaiter().GetResult()); }