mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-10-04 10:21:13 +00:00
Added UnsubscribeAllAsync method to Shared APIs ISharedSubscription and IShaerdApiClientBase
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CryptoExchange.Net.SharedApis
|
namespace CryptoExchange.Net.SharedApis
|
||||||
{
|
{
|
||||||
@@ -104,6 +105,11 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
SharedCapabilityResolution<T>? GetCapability<T>(SharedCapabilityReference<T> capability, TradingMode tradingMode)
|
SharedCapabilityResolution<T>? GetCapability<T>(SharedCapabilityReference<T> capability, TradingMode tradingMode)
|
||||||
where T : ISharedApiCapability;
|
where T : ISharedApiCapability;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unsubscribes all subscriptions created by the underlying socket API
|
||||||
|
/// client and closes its subscription connections.
|
||||||
|
/// </summary>
|
||||||
|
Task UnsubscribeAllAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -209,6 +215,15 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
return GetCapabilities<T>(tradingMode);
|
return GetCapabilities<T>(tradingMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public Task UnsubscribeAllAsync()
|
||||||
|
{
|
||||||
|
return Task.WhenAll(
|
||||||
|
_sharedApis
|
||||||
|
.OfType<ISharedSubscription>()
|
||||||
|
.Select(x => x.UnsubscribeAllAsync()));
|
||||||
|
}
|
||||||
|
|
||||||
object? ISharedApiClientResolver.GetCapability(Type capabilityType)
|
object? ISharedApiClientResolver.GetCapability(Type capabilityType)
|
||||||
{
|
{
|
||||||
return _sharedApis
|
return _sharedApis
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CryptoExchange.Net.SharedApis
|
namespace CryptoExchange.Net.SharedApis
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shared WebSocket API subscription capabitlity
|
/// Shared WebSocket API subscription capability
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ISharedSubscription : ISharedSocket
|
public interface ISharedSubscription : ISharedSocket
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Unsubscribes all subscriptions created by the underlying socket API
|
||||||
|
/// client and closes its subscription connections.
|
||||||
|
/// </summary>
|
||||||
|
Task UnsubscribeAllAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user