using CryptoExchange.Net.RateLimiting.Interfaces; using System.Net.Http; namespace CryptoExchange.Net.Objects { /// /// The definition of a rest request /// public class RequestDefinition { private string? _stringRep; // Basics /// /// Path of the request /// public string Path { get; set; } /// /// Http method of the request /// public HttpMethod Method { get; set; } /// /// Is the request authenticated /// public bool Authenticated { get; set; } // Formatting /// /// The body format for this request /// public RequestBodyFormat? RequestBodyFormat { get; set; } /// /// The position of parameters for this request /// public HttpMethodParameterPosition? ParameterPosition { get; set; } /// /// The array serialization type for this request /// public ArrayParametersSerialization? ArraySerialization { get; set; } // Rate limiting /// /// Request weight /// public int Weight { get; set; } = 1; /// /// Rate limit gate to use /// public IRateLimitGate? RateLimitGate { get; set; } /// /// Individual endpoint rate limit guard to use /// public IRateLimitGuard? LimitGuard { get; set; } /// /// Whether this request should never be cached /// public bool PreventCaching { get; set; } /// /// Connection id /// public int? ConnectionId { get; set; } /// /// ctor /// /// /// public RequestDefinition(string path, HttpMethod method) { Path = path; Method = method; } /// public override string ToString() { return _stringRep ??= $"{Method} {Path}{(Authenticated ? " authenticated" : "")}"; } } }