mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-22 22:02:59 +00:00
Feature/ratelimit refactor (#197)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using CryptoExchange.Net.Objects;
|
||||
using System.Net.Http;
|
||||
using System.Security;
|
||||
|
||||
namespace CryptoExchange.Net.RateLimiting.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Rate limit guard
|
||||
/// </summary>
|
||||
public interface IRateLimitGuard
|
||||
{
|
||||
/// <summary>
|
||||
/// Name
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Description
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether a request can pass this rate limit guard
|
||||
/// </summary>
|
||||
/// <param name="type">The rate limit item type</param>
|
||||
/// <param name="definition">The request definition</param>
|
||||
/// <param name="host">The host address</param>
|
||||
/// <param name="apiKey">The API key</param>
|
||||
/// <param name="requestWeight">The request weight</param>
|
||||
/// <returns></returns>
|
||||
LimitCheck Check(RateLimitItemType type, RequestDefinition definition, string host, SecureString? apiKey, int requestWeight);
|
||||
|
||||
/// <summary>
|
||||
/// Apply the request to this guard with the specified weight
|
||||
/// </summary>
|
||||
/// <param name="type">The rate limit item type</param>
|
||||
/// <param name="definition">The request definition</param>
|
||||
/// <param name="host">The host address</param>
|
||||
/// <param name="apiKey">The API key</param>
|
||||
/// <param name="requestWeight">The request weight</param>
|
||||
/// <returns></returns>
|
||||
RateLimitState ApplyWeight(RateLimitItemType type, RequestDefinition definition, string host, SecureString? apiKey, int requestWeight);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user