mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 16:06:15 +00:00
Added OptionalExchangeParameters, UnsupportedOptionalParameters and Supported to shared EndpointOptions
This commit is contained in:
parent
c070c425e7
commit
c1dde521af
@ -17,6 +17,10 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ParameterDescription> RequiredExchangeParameters { get; set; } = new List<ParameterDescription>();
|
public List<ParameterDescription> RequiredExchangeParameters { get; set; } = new List<ParameterDescription>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Optional exchange-specific parameters
|
||||||
|
/// </summary>
|
||||||
|
public List<ParameterDescription> OptionalExchangeParameters { get; set; } = new List<ParameterDescription>();
|
||||||
|
/// <summary>
|
||||||
/// Endpoint name
|
/// Endpoint name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string EndpointName { get; set; }
|
public string EndpointName { get; set; }
|
||||||
@ -28,6 +32,10 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Whether the call requires authentication
|
/// Whether the call requires authentication
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool NeedsAuthentication { get; set; }
|
public bool NeedsAuthentication { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the call is supported by the exchange
|
||||||
|
/// </summary>
|
||||||
|
public bool Supported { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ctor
|
/// ctor
|
||||||
@ -71,12 +79,16 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual string ToString(string exchange)
|
public virtual string ToString(string exchange)
|
||||||
{
|
{
|
||||||
|
if (!Supported)
|
||||||
|
return $"{exchange} {EndpointName} NOT SUPPORTED";
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.AppendLine($"{exchange} {EndpointName}");
|
sb.AppendLine($"{exchange} {EndpointName}");
|
||||||
if (!string.IsNullOrEmpty(RequestNotes))
|
if (!string.IsNullOrEmpty(RequestNotes))
|
||||||
sb.AppendLine(RequestNotes);
|
sb.AppendLine(RequestNotes);
|
||||||
sb.AppendLine($"Needs authentication: {NeedsAuthentication}");
|
sb.AppendLine($"Needs authentication: {NeedsAuthentication}");
|
||||||
sb.AppendLine($"Required exchange specific parameters: {string.Join(", ", RequiredExchangeParameters.Select(x => x.ToString()))}");
|
sb.AppendLine($"Required exchange specific parameters: {string.Join(", ", RequiredExchangeParameters.Select(x => x.ToString()))}");
|
||||||
|
sb.AppendLine($"Optional exchange specific parameters: {string.Join(", ", OptionalExchangeParameters.Select(x => x.ToString()))}");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,6 +103,10 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Required optional parameters in the request
|
/// Required optional parameters in the request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ParameterDescription> RequiredOptionalParameters { get; set; } = new List<ParameterDescription>();
|
public List<ParameterDescription> RequiredOptionalParameters { get; set; } = new List<ParameterDescription>();
|
||||||
|
/// <summary>
|
||||||
|
/// Unsupported optional parameters in the request
|
||||||
|
/// </summary>
|
||||||
|
public List<ParameterDescription> UnsupportedOptionalParameters { get; set; } = new List<ParameterDescription>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ctor
|
/// ctor
|
||||||
@ -130,6 +146,9 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string ToString(string exchange)
|
public override string ToString(string exchange)
|
||||||
{
|
{
|
||||||
|
if (!Supported)
|
||||||
|
return $"{exchange} {EndpointName} NOT SUPPORTED";
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.AppendLine($"{exchange} {typeof(T).Name}");
|
sb.AppendLine($"{exchange} {typeof(T).Name}");
|
||||||
sb.AppendLine($"Needs authentication: {NeedsAuthentication}");
|
sb.AppendLine($"Needs authentication: {NeedsAuthentication}");
|
||||||
@ -137,8 +156,12 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
sb.AppendLine(RequestNotes);
|
sb.AppendLine(RequestNotes);
|
||||||
if (RequiredOptionalParameters.Any())
|
if (RequiredOptionalParameters.Any())
|
||||||
sb.AppendLine($"Required optional parameters: {string.Join(", ", RequiredOptionalParameters.Select(x => x.ToString()))}");
|
sb.AppendLine($"Required optional parameters: {string.Join(", ", RequiredOptionalParameters.Select(x => x.ToString()))}");
|
||||||
|
if (UnsupportedOptionalParameters.Any())
|
||||||
|
sb.AppendLine($"Unsupported optional specific parameters: {string.Join(", ", UnsupportedOptionalParameters.Select(x => x.ToString()))}");
|
||||||
if (RequiredExchangeParameters.Any())
|
if (RequiredExchangeParameters.Any())
|
||||||
sb.AppendLine($"Required exchange specific parameters: {string.Join(", ", RequiredExchangeParameters.Select(x => x.ToString()))}");
|
sb.AppendLine($"Required exchange specific parameters: {string.Join(", ", RequiredExchangeParameters.Select(x => x.ToString()))}");
|
||||||
|
if (OptionalExchangeParameters.Any())
|
||||||
|
sb.AppendLine($"Optional exchange specific parameters: {string.Join(", ", RequiredExchangeParameters.Select(x => x.ToString()))}");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user